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