char *pmsg = "hello,world!"; char *pnsg = "hi,there."; strcpy(pmsg,pnsg); 这样无法编译, 如果都换成是数组的话就可以编译.那个很好理解. 难道是指针指向的常量字符串是不能随意改变的??? 有点晕??
指针定义两个字符串,用strcpy交换问题?
最新推荐文章于 2024-03-02 20:41:03 发布
char *pmsg = "hello,world!"; char *pnsg = "hi,there."; strcpy(pmsg,pnsg); 这样无法编译, 如果都换成是数组的话就可以编译.那个很好理解. 难道是指针指向的常量字符串是不能随意改变的??? 有点晕??