fork(1) download
  1. #include <stdio.h>
  2. #define SWAP(a,b,c) c t;t=*a;*a=*b;*b=t;
  3.  
  4. int main(void)
  5. {
  6. int x=10,y=20;
  7. printf("Before swapping\n");
  8. printf("%d %d\n",x,y);
  9. SWAP(&x,&y,int);
  10. printf("After swapping\n");
  11. printf("%d %d\n",x,y);
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
Before swapping
10 20
After swapping
20 10