Test 函数的语句GetMemory(str, 200)并没有使str 获得期望的内存,str 依旧是NULL,为什么?void GetMemory(char *p, int num){p = (char *)malloc(sizeof(char) * num);}void T...
全文
回复(11) 2005-07-30 21:22 来自版块 - c/c++入门(VC,KeilC使用)
表情
znsoft你需要判断malloc时能不能正确分配. 而且你的作法是错的.正确的应该这样写 void GetMemory(char **p, int num) { *p = (char *)malloc(sizeof(char) * num); } void Test(void) { c...(2005-07-31 10:17)

返回顶部