1 字符与字符串:char c='a'而不能写出char c="a" //字符变量用单引号'',而字符串用双引号。
2 字符数组与字符指针的初始化:
char s[10]={0}, *p
strcpy(s,"hello word ");或者p="hello word ";
而不能用s="hello word "y因s数组名表示数组的首地址是个常量。
字符数组的0初始化:
方法1:char s[10]={0};
方法2: memset(s,0,10);
方法3: for循环中初始化:
int i,s[10],*p; 或者 int i,s[10],*p;
p=s for(p=a;p<a+10;p++)
for(i=0;i<10;i++) scanf("%d",p);
scanf(:%d”,p++);
而不能:
int i,a[10];
for (i=0;i<10;i++)
scanf("%d",a++);//数组的首地址是不能改变的。
4字符数组 字符指针 字符串 strlen() sizeof
4.1字符数组 :char a[]="string"或者={‘s','t','r','i','n','g'}
4.2字符串:系统遇到字符串都会在末尾加上结束符“