s关于trcpy
//#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");
}
哪里错了呢 错误提示?
页:
[1]