fork download
  1. #include <iostream>
  2.  
  3. char* foo()
  4. {
  5. int size{5};
  6. char* result = new char[size];
  7. std::cin >> result;
  8. return result;
  9. }
  10.  
  11. int main()
  12. {
  13. char* text = foo();
  14. std::cout << text;
  15. delete[] text;
  16. }
Success #stdin #stdout 0s 3472KB
stdin
Text
stdout
Text