fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int* foo() {
  7. int a[3] {1, 2, 3};
  8. return a;
  9. }
  10.  
  11. int* bar(string x) {
  12. int a[3] {1, 2, 3};
  13. return a;
  14. }
  15.  
  16. int main() {
  17. int *p = foo();
  18. cout << p[0] << " " << p[1] << " " << p[2] << endl;
  19.  
  20. int *q = bar("X");
  21. cout << q[0] << " " << q[1] << " " << q[2] << endl;
  22.  
  23. return 0;
  24. }
Runtime error #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty