仅做学习记录。
voidgetmemory(charp){p=(char)malloc(100);strcpy(p,“helloworld”);}intmain(){char*str=NULL;getmemory(str);printf(“%s/n”,str);free(str);return0;}会出现什么问题?【标准答案】程序崩溃,getmemory中的malloc不能返回动态内存,free()对str操作很
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号