标签:
在主调用函数中分配内存:
1 char **myarray = (char **)malloc(10*sizeof(char *)); 2 if (myarray == NULL) 3 { 4 return -1; 5 } 6 for (i=0; i<10; i++) 7 { 8 myarray[i] = (char *)malloc(100); 9 }
释放内存:
1 for(i=0; i<10; i++) 2 { 3 free(myarray[i]); 4 } 5 if (myarray) 6 { 7 free(myarray); 8 }
标签:
原文地址:http://www.cnblogs.com/shiddong/p/4418440.html