Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1.  
  2.  
  3. void test(int a)
  4. {
  5.     a++;
  6. };
  7.  
  8. void test2(int &a)
  9. {
  10.     a++;
  11. };
  12.  
  13. int main()
  14. {
  15.     int a = 0;
  16.     test(a);
  17.  
  18.     cout << a; // выведет 0
  19.  
  20.     test2(a);
  21.    
  22.     cout << a; // выведет 1
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement