Advertisement
Josif_tepe

Untitled

Dec 16th, 2023
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 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.     a = new int;
  12.     b = new int;
  13.     cin >> (*a) >> (*b);
  14.    
  15.     my_swap(a, b);
  16.     cout << *a << " " << *b << endl;
  17.     return 0;
  18. }
  19. /*
  20.  5
  21.  1 2 3 4 5
  22.  5
  23.  **/
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement