请教字符串指针的问题
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char* p = "abc";
//*p +1 = 'd';
char* t = new char[strlen(p)+1];
*t = "werdsf";//为什么不能赋值?
cout<<t<<endl;
return 0;
}
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char* p = "abc";
//*p +1 = 'd';
char* t = new char[strlen(p)+1];
*t = "werdsf";//为什么不能赋值?
cout<<t<<endl;
return 0;
}