这是一个来自interiew的问题,以及下面的代码.这个功能有什么问题?
string f() {
return "hello world";
}
Run Code Online (Sandbox Code Playgroud)
对我来说,没有任何错误,我甚至可以使用此功能运行程序:
#include <iostream>
#include <string>
using namespace std;
string f() {
return "hello world";
}
int main() {
string s2=f();
cout<<s2<<endl;
}
Run Code Online (Sandbox Code Playgroud)
什么是错这个功能呢?