GetMemory(char **p, int num)

来源:互联网 发布:淘宝哪家眼镜店好 编辑:程序博客网 时间:2024/06/07 09:21
#include<stdio.h>#include<stdlib.h>#include<string.h>void GetMemory(char **p, int num){*p = (char *)malloc(num); } void Test(void){ char *str = NULL;GetMemory(&str, 100); strcpy(str, "hello\n"); printf(str); free(str); } //请问运行Test 函数会有什么样的结果?void main(){Test();}/*helloPress any key to continue*/

原创粉丝点击