fork download
  1. #include <stdio.h>
  2.  
  3. void swap(int *x, int *y){
  4. int tmp = *y;
  5. *y = *x;
  6. *x = tmp;
  7. }
  8.  
  9. int main() {
  10. int x = 100;
  11. int y = 200;
  12.  
  13. swap(&x, &y);
  14. printf("x=%d,y=%d\n",x,y);
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
x=200,y=100