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