【发布时间】:2012-08-19 18:50:38
【问题描述】:
我有这样的事情
char *temp, xyz;
temp = (char *)malloc(sizeof(somestring));
xyz = (char *) malloc(sizeof(temp));
xyz= strrchar(temp, "_"); // temp does not contain "_", but need to check for error validation
现在如果我尝试做 免费(临时); 它崩溃了;
任何想法,我是初学者。
【问题讨论】:
-
你确定它在 free() 上崩溃了吗?你是如何填写温度的?
-
使用正确的编译器设置不应该编译(使用它们是有原因的!)
-
temp 被分配了 strcpy call strcpy(temp, something);
标签: c