1 #include<stdio.h> 2 int main() 3 { 4 char *a="abcdefg"; 5 char *p; 6 p=a; 7 printf("p1=%s\t",p); 8 printf("*p=%c\n",*p); 9 *p++; 10 printf("p2=%s\t",p); 11 printf("*2p=%c\n",*p); 12 }
p1=abcdefg *p=a p2=bcdefg *2p=b*p++相当于*(p++);指针进行了偏移
1 #include<stdio.h> 2 int main() 3 { 4 char *a="abcdefg"; 5 char *p; 6 p=a; 7 printf("p1=%s\t",p); 8 printf("*p=%c\n",*p); 9 *p++; 10 printf("p2=%s\t",p); 11 printf("*2p=%c\n",*p); 12 }
p1=abcdefg *p=a p2=bcdefg *2p=b*p++相当于*(p++);指针进行了偏移