指针和数组名有的时候可以通用,但有以下两点谨记:
1 数组名是常指针,即指向的位置不能再改变
2 请看如下代码
char *p1 = "ludonghai";
char p2[] = "ludonghai";
printf("%d/n", sizeof(p1)); //out put 4
printf("%d/n", sizeof(p2)); //out put 9
printf("%d/n", strlen(p1));//out put 9
printf("%d/n", strlen(p2));//out put 9