#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *str1 =(char*)malloc(30*sizeof(char));
char *str2 =(char*)malloc(30*sizeof(char));
str1 ="123";
str2 ="1234";
printf("%s\n",str2);
strcpy(str2,str1);
printf("%s",str2);
free(str1);
free(str2);
return 0;
}
运行到strcpy直接segmentation崩溃