这段代码不起作用有什么原因吗?
char* toString(struct number *this) {
char *res;
if (!this) {
res = malloc(sizeof(char));
*res = '\0';
return res;
}
*/
other working code
*/
}
当我尝试使用 printf 打印时出现“分段错误”:
char *s = toString(NULL);
printf("%s\n", s);
谢谢。