c++中string类的操作
#include<iostream>#include<string>usingnamespacestdvoidmain(){stringstr("abcdefg");ch...
#include<iostream>
#include <string>
using namespace std
void main(){
string str("abcdefg");
char* s;
s=str.c_str() ;
cout <<s;
}
报错为 cannot convert from 'const char *' to 'char *'
Conversion loses qualifiers
str.c_str()返回值是指针常量? 展开
#include <string>
using namespace std
void main(){
string str("abcdefg");
char* s;
s=str.c_str() ;
cout <<s;
}
报错为 cannot convert from 'const char *' to 'char *'
Conversion loses qualifiers
str.c_str()返回值是指针常量? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询