|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
//#include "iostream"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
//using namespace std;
char *getMem(int num)
{
char *p1 = NULL;
p1 = (char *)malloc(sizeof(char) *num);
if (p1 == NULL)
{
return NULL;
}
return p1;
}
void main()
{
char *temp = NULL;
temp = getMem(100);
if (temp == NULL)
{
return;
}
strcpy(temp, "as");
printf("temp:%s\n", temp);
printf("hello...\n");
system("pause");
}
哪里错了呢 |
|