C Primer Plus中
ok,11.1.1在程序中定义字符串
三、数组和指针
首先看下面的小程序:
1 #include<stdio.h> 2 3 int main(void) 4 { char m4[] = "this is amzing"; 5 char *m3 ="yeah,you are right"; 6 7 //printf("%s ",++m4); 8 printf("%s ",m4+1); 9 printf("%s ",++m3); 10 11 return 0; 12 }
数组名字 m4 是个 常量;而指针 m3 是个变量;
威力加强版代码如下
1 #include<stdio.h> 2 3 int main(void) 4 { char m4[] = "this is amzing"; 5 char *m3 ="yeah,you are right"; 6 7 //printf("%s ",++m4); 8 printf("%s ",m4+1); 9 printf("%s ",++m3); 10 11 12 //1.指针可以这样指针运算符,但是数组名字就不行了哦 13 while( *m3 != '