C语言二维数组,字符串数组,指针数组指针遍历

C语言二维数组,字符串数组,指针数组指针遍历_第1张图片

 

 

#include
char * stringCom(char** str,int size) ;
int main()
{
  int i,len;
  char * temp ;
  char * a[]={"China","French","America","German"}; //1
  char ** s = a; //2
  printf("%d\n",sizeof(a)/sizeof(a[0]));//4块区域
  printf("a[0]=%s\n",a[0]);
  printf("*(s+1)=%s\n",*(s+1));
  printf("第二行第二个元素*(*(s+1)+2)=%c\n",*(*(s+1)+2));
  len =sizeof(a)/sizeof(a[0]);
  for( i=0;i   {
    printf("%c\n",*(*(s+0)+i));
    //printf("%c\n",s[0][i]);
  }
  temp = stringCom(s,len);

  }

char * stringCom(char** str,int size) {
  int i;
  printf("函数中遍历\n");
  for(i=0;i   {
  printf("%s\n",str[i]);
  }
}

你可能感兴趣的:(C语言二维数组,字符串数组,指针数组指针遍历)