char * s = "hello"; 等价于 char s[]= "hello";
字符串数组表示使用 char *name[] 或者char name[] [10];
简单例子:
#include <stdio.h>
int main()
{
char* s = "hello";
char s1[] = "hello1";
char *name[] = { "hello1","hello2","hello3","hello4","hello5","hello6","hello7","hello8" };
printf("输出s:%s\n", s);
printf("输出s1:%s\n", s1);
printf("输出s1[1]:%c\n", s1[1]);
printf("输出s1[5]:%c\n", s1[5]);
printf("输出name[0]:%s\n", name[0]);
printf("输出name[1]:%s\n", name[1]);
printf("输出name[2]:%s\n", name[2]);
return 0;
}
结果为: