Guest User

Untitled

a guest
Jun 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void swap( int *, int *);
  5.  
  6. int main()
  7. {
  8. int m = 10;
  9. int n = 20;
  10.  
  11. cout << m << " " << n << endl;
  12. swap(&m, &n);
  13.  
  14. cout << m << " " << n << endl;
  15.  
  16. system("PAUSE");
  17.  
  18. }
  19.  
  20. void swap (int *m, int *n)
  21. {
  22. int temp;
  23.  
  24. temp = *n;
  25.  
  26. *n = *m;
  27.  
  28. *m = temp;
  29. }
Add Comment
Please, Sign In to add comment