fork download
  1. #include <iostream>
  2.  
  3. int& foo()
  4. {
  5. int a = 0;
  6. return a;
  7. }
  8.  
  9. int& bar()
  10. {
  11. int a = 10;
  12. return a;
  13. }
  14.  
  15. int main()
  16. {
  17. int& k = foo();
  18. std::cout << k << std::endl;
  19. bar();
  20. std::cout << k << std::endl;
  21. return 0;
  22. }
Runtime error #stdin #stdout 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty