char str[6] = {‘a’,‘b’,‘c’,‘d’,‘e’,‘f’}
char str2[6] = “abcdef”
char str3[]=“sfsvsdfsdfsdgdf”
//数组元素个数不写,会根据真是大小来默认分配
这三种定义方法 都不太好
数组名就是地址(大多数情况下)
//指针方式,如果操作不恰当,内存非法,易造成段错误
char *pstr = “hellow world”
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *pstr = “hellow world”;
printf("%s\n",pstr);
system(“pause”);
return 0;
}