64,649
社区成员
发帖
与我相关
我的任务
分享
char *GetMemory(void)
{
char p[] = "hello world";
char* ret=new char[strlen(p)+1];
memcpy(ret,p,strlen(p)+1);
return ret;
}
void Test(void)
{
char *str = NULL;
str = GetMemory();
printf(str);
delete[] str;//不要忘了这个
}
char *GetMemory(void)
{
char p[] = "hello world";
char* ret=new char[strlen(p)+1];
return ret;
}
void Test(void)
{
char *str = NULL;
str = GetMemory();
printf(str);
delete[] str;//不要忘了这个
}