fork(1) download
  1. #include <stdio.h>
  2.  
  3. void swap(int *x, int *y) {
  4. int temp = *x;
  5. *x = *y;
  6. *y = temp;
  7. }
  8.  
  9. void ascend(int *x, int *y, int *z) {
  10. if (*x > *y) {
  11. swap(x, y);
  12. }
  13. if (*y > *z) {
  14. swap(y, z);
  15. }
  16. if (*x > *y) {
  17. swap(x, y);
  18. }
  19. }
  20.  
  21. void scanfall(int *x, int *y, int *z) {
  22. printf("a: ");
  23. scanf("%d", x);
  24.  
  25. printf("b: ");
  26. scanf("%d", y);
  27.  
  28. printf("c: ");
  29. scanf("%d", z);
  30. }
  31.  
  32. int main() {
  33. int a, b, c;
  34.  
  35. scanfall(&a, &b, &c);
  36.  
  37. ascend(&a, &b, &c);
  38.  
  39. printf(" %d, %d, %d\n", a, b, c);
  40.  
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 5456KB
stdin
14 17 13
stdout
a: b: c:  13, 14, 17