Advertisement
Josif_tepe

Untitled

Dec 16th, 2023
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void my_swap(int * a, int * b) {
  5.     int tmp = *a;
  6.     *a = *b;
  7.     *b = tmp;
  8. }
  9. int main() {
  10.     int a, b;
  11.     cin >> a >> b;
  12.    
  13.     my_swap(&a, &b);
  14.     cout << a << " " << b << endl;
  15.     return 0;
  16. }
  17. /*
  18.  5
  19.  1 2 3 4 5
  20.  5
  21.  **/
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement