問題描述在C語言項目中的某個函數(shù)里使用malloc來申請空間。最后函數(shù)返回保存在這個空間的值,也就是在函數(shù)中并沒有free申請的空間,那么在函數(shù)外需要free嗎?相關代碼char *test() { char *op = malloc(sizeof(char) * 16);
... return op;
}
int main() { printf("%s", test());
}
添加回答
舉報
0/150
提交
取消