fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int y = 1;
  5.  
  6. int f1(int x)
  7. {
  8. y = y * 2;
  9. return y*x;
  10. }
  11.  
  12. int f2(int *x)
  13. {
  14. int y = (*x) * 2;
  15. return y*(*x);
  16. }
  17.  
  18. int main()
  19. {
  20. /*(1)*/ int y = f1(1);
  21. /*(2)*/ cout << y << endl;
  22. /*(3)*/ cout << f2(&y) << endl;
  23. /*(4)*/ cout << f1(1) << endl;
  24. /*(5)*/ cout << y << endl;
  25. /*(6)*/ cout << ::y << endl;
  26. //_getch();
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 4164KB
stdin
Standard input is empty
stdout
2
8
4
2
4