I tried following code :
#include #include using namespace std; string f1(string s) { return s=\"f1 called\"; } void f2(s
Try this:
int main() { string str; string str2 = f1(str); // copy the temporary f2(&str2); }