69,382
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
#include<string.h>
main()
{
char *s = "abd";
char *t = "eee";
strcpy(s,t);
printf("%s ",s);
return 0;
}
#include<stdio.h>
#include<string.h>
main()
{
char s[10] = "abd";
char t[10] = "eee";
char *a = s;
char *b = t;
strcpy(a,b);
printf("%s ",a);
return 0;
}
char *s = "abd"; //abd这个字符串是存储在常量区,不允许写入访问,所以你后面会出错。
char s[10] = "abd"; //abd这个字符串存储在字符数组中,允许写入访问。