二级指针操作二维字符串数组

#include 
#include 
int main(){
    char *a[20]={"saa","sdadsa"};
    //or char a[20][10]={"saa","sdadsa"};
    char **p=NULL;
    p=(char **)malloc(sizeof(char *)*2);
    p[0]=a[0];
    p[1]=a[1];
    printf("%s\n",p[0] );
    printf("%s\n",p[1] );
    printf("(%d)\n",sizeof(char *) );
    printf("(%d)\n",sizeof(double *) );
    printf("(%d)\n",sizeof(int  *) );
    return 0;
}

你可能感兴趣的:(C语言学习)