fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. string MyString()
  7. {
  8. return string("Hello!");
  9. }
  10.  
  11. string UseString(string &s)
  12. {
  13. return s + " Bye!!!";
  14. }
  15.  
  16. int main()
  17. {
  18. cout << MyString() << endl;
  19. cout << UseString(MyString()) << endl;
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:19: error: invalid initialization of non-const reference of type ‘std::string&’ from a temporary of type ‘std::string’
prog.cpp:11: error: in passing argument 1 of ‘std::string UseString(std::string&)’
stdout
Standard output is empty