char *strcpy(char *dest, const char *src); //第二个参数是常指针的 he strcpy() function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest.
[解决办法]
错了 反过来也不对,不能往NULL里面拷东西。。。 [解决办法]
如果你往a里拷贝就有问题了 [解决办法]
char *a = "k"; //这个是常量字符串,存放在静态区,只可读,不可改!!!!
//有时间看看内存管理吧!
我这修改a完全没问题
#include<iostream> int main() { char *a = "l";//"test"; char *b= "test"; a = "ss"; //strcpy(a,b); std::cout<<a; system("pause"); }