函数的执行

changeyourmind changeyourmind 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include "stdio.h"
#include "string.h"
#include "windows.h"
void GetMemory(char *cpStr)
{
cpStr = new char[100];
return;
}

void Test(void)
{
char *cp_str = NULL;
GetMemory(cp_str);
strcpy(cp_str,"Hello,world!");
printf(cp_str);

return;
}

void main()
{
Test();
}

请问程序会发生什么情况?以及详细解释产生此种情况的原因?
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
changeyourmind
C++ Builder 13,871 成员 102,696 内容