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