64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
void fun(const string &str) //string::string(const char *)
{
cout<<str<<endl;
}
int main()
{
char buf[6]="Hello";
fun(buf);
return 0;
}
error C2664: “fun”: 不能将参数 1 从“char [6]”转换为“std::string &”