指针&指针的指针,地址&地址的地址
1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int main(int argc, char* argv[]) 5 { 6 char *s[]={"man","woman","girl","boy","sister"}; 7 char* *q=NULL; //指针的指针 8 int k; 9 for(k=0;k<5;k++) 10 { 11 q=&s[k]; //p放入一维数组地址的地址(s[k]已经是一位数组地址了) 12 printf("%s\n",*q); 13 } 14 system("pause"); 15 return 0; 16 }
1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 int main(int argc, char* argv[]) 5 { 6 char *s[]={"man","woman","girl","boy","sister"}; 7 char *q=NULL; //普通指针 8 int k; 9 for(k=0;k<5;k++) 10 { 11 q=s[k]; //p放入一维数组地址 12 printf("%s\n",*q); 13 } 14 system("pause"); 15 return 0; 16 }