相关疑难解决方法(0)

char*和char []

为什么这是对的?

#include<iostream>
using namespace std;
int main()
{
    char *s="raman";
    char *t="rawan";
    s=t;
    cout<<s;

return 0;
}
Run Code Online (Sandbox Code Playgroud)

但这是错的?

#include<iostream>
using namespace std;
int main()
{
    char s[]="raman";
    char t[]="rawan";
    s=t;
    cout<<s;

return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++

4
推荐指数
2
解决办法
1082
查看次数

标签 统计

c++ ×1