#include <stdio.h> #include <stdlib.h> #include <string.h> void fun1(char** s); void fun2(char** s); void fun3(char** s); void fun1(char** s) { char* _s = *s; *s = (char*)malloc(sizeof(char)*100); strcpy( *s,"11" ); //*s = (char*)("11"); 不可以这样赋值,会造成内存泄露 printf( "%s ",*s ); fun2(s); } void fun2(char** s) { strcpy( *s,"22" ); printf( "%s ",*s ); fun3(s); } void fun3(char** s) { strcpy( *s,"33" ); printf( "%s ",*s ); } int main() { char *_s = NULL; char** s = &_s; fun1(s); printf( "final ; %s ",*s ); free( *s ); return 0; }