fork download
  1. #include <stdio.h>
  2.  
  3. void myswitch(int* a, int* b);
  4.  
  5. int main(void) {
  6. int a,b,c;
  7. scanf("%d %d %d",&a,&b,&c);
  8.  
  9. if ( a > b) myswitch(&a, &b);
  10. if ( b > c) myswitch(&b, &c);
  11. if ( a > b) myswitch(&a, &b);
  12.  
  13. printf("%d %d %d",a,b,c);
  14. return 0;
  15. }
  16.  
  17. void myswitch(int *a, int *b){
  18. int tmp = *a;
  19. *a = *b;
  20. *b = tmp;
  21. }
Success #stdin #stdout 0s 5324KB
stdin
3 8 1
stdout
1 3 8