inhuman_Arif

Swapping with pointer

Oct 12th, 2021
722
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void swap(int *x,int *y)
  4. {
  5.     int temp = *x;
  6.     *x = *y;
  7.     *y = temp;
  8. }
  9.  
  10. int main()
  11. {
  12.     int n,m;
  13.     scanf("%d %d",&n,&m);
  14.     swap(&n,&m);
  15.     printf("%d %d\n",n,m);
  16.  
  17.     return 0;
  18. }
RAW Paste Data