看一下这个C程序,谢谢!
void getmemory(char *p)
{
p=(char *) malloc(100);
strcpy(p,“hello world”);}
int main( )
{
char *str=NULL;
getmemory(str);
printf(“%s/n”,str);
free(str);
return 0;}
void getmemory(char **p)
{
*p=(char *) malloc(100);
strcpy(*p,"hello world");
}
char *str=NULL;
getmemory(&str);
printf("%s/n",str);
free(str);