Guest User

Untitled

a guest
Jul 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void foo(int x, int y) {
  5. x = 3;
  6. cout << "1: " << x * y << endl;
  7. }
  8.  
  9. void bar(int & x, int & y) {
  10. x = 3;
  11. cout << "2: " << x * y << endl;
  12. }
  13.  
  14. int main(int argc, char **argv) {
  15. int a,b;
  16. a = 2;
  17. b = 2;
  18.  
  19. foo(a,a);
  20. bar(b,b);
  21.  
  22. cout << "end: " << a << "," << b << endl;
  23.  
  24. return 0;
  25. }
  26.  
  27. // Lala:Desktop jeena$ ./a.out
  28. // 1: 6
  29. // 2: 9
  30. // end: 2,3
Add Comment
Please, Sign In to add comment