第一种情况:表达式中引用的数组名就是“指针”;
char str[10] = "abcdefg";
printf("%c\n", *(str + 4));
第二种情况:数组的下标引用和指针偏移量的使用等价;
char str[10] = "abcdefg";
char *p = str;
printf("%c \n", p[5]);
第三种情况:数组作为函数的形参时“退化”为指针;
#include <stdio.h>
void TestFunc(char str[])
{
printf("sizeof(str) = %ld\n", sizeof(str));
}
int main()
{
char str[20] = "abcdefg98ty";
TestFunc(str);
return 0;
}