1. 定义char **类型变量,初始化为NULL
2. 分配行指针数组空间
3. 为每行分配空间
4. 释放每行的空间
5. 释放二维指针
void main() { char **pointer=NULL; int pointer_n1 = 4; int pointer_n2 = 3; int i = 0; pointer = (char **)malloc( pointer_n1 * sizeof(char *) ); for( i=0;i<point_n1;i++ ) { pointer[i] = (char *)malloc( pointer_n2 ); } for( i=0;i<point_n1;i++ ) { free( pointer[i] ); } free( pointer ); }