fork download
  1. #include <stdio.h>
  2. void swap(int*a,int*b);
  3. void sort(int*x,int*y);
  4. int main(void){
  5. int x,y;
  6. scanf("%d%d",&x,&y);
  7. printf("Before:x=%d,y=%d\n",x,y);
  8. sort(&x,&y);
  9. printf("After:x=%d,y=%d\n",x,y);
  10. return 0;
  11. }
  12. void swap(int*a,int*b)
  13. {
  14. int w;
  15. w=*a;
  16. *a=*b;
  17. *b=w;
  18. }
  19. void sort(int*x,int*y)
  20. {
  21. if (*x<*y){
  22. swap(x,y);
  23. }
  24. }
  25.  
Success #stdin #stdout 0.01s 5320KB
stdin
8
12
stdout
Before:x=8,y=12
After:x=12,y=8