fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int global = 10;
  6.  
  7. void func(int &x, int y)
  8. {
  9. x = x - y;
  10. y = x * 10;
  11. cout << x << " , " << y << '\n';
  12. }
  13.  
  14. int main()
  15. {
  16. int global = 7;
  17.  
  18. func(::global, global);
  19. cout << global << " , " << ::global << '\n';
  20. func(global, ::global);
  21. cout << global << " , " << ::global << '\n';
  22. }
  23.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
3 , 30
7 , 3
4 , 40
4 , 3