fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int x;
  5. int& func() {
  6. return x;
  7. }
  8.  
  9. int main() {
  10. func()++;
  11. cout << x << endl;
  12. func()++;
  13. cout << x << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1
2