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