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