Guest User

Untitled

a guest
Feb 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void swapTwoValues(int* x, int* y)
  4. {
  5. int temp = *x;
  6. *x = *y;
  7. *y = temp;
  8. }
  9.  
  10. int main(void)
  11. {
  12. int x = 10;
  13. int y = 20;
  14. printf("x = %d , y = %d\n", x, y);
  15. // address(reference)
  16. swapTwoValues(&x, &y);
  17. printf("x = %d , y = %d\n", x, y);
  18. }
Add Comment
Please, Sign In to add comment