Advertisement
Josif_tepe

Untitled

Jan 5th, 2023
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. void swap(int * x, int * y) { // pass by reference
  7.     int pom = *x;
  8.     *x = *y;
  9.     *y = pom;
  10. }
  11. int main(int argc, const char * argv[]) {
  12.     int x, y;
  13.     scanf("%d%d", &x, &y);
  14.    
  15.     swap(&x, &y);
  16.     printf("%d %d\n", x, y);
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement