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