fork 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 sort(int *x, int *y) {
  10. if (*x < *y) {
  11. swap(x, y);
  12. }
  13. }
  14.  
  15. int main(void) {
  16. int x, y;
  17.  
  18. printf("x : "); scanf("%d", &x);
  19. printf("y : "); scanf("%d", &y);
  20.  
  21. sort(&x, &y);
  22.  
  23. printf("降順: x = %d, y = %d\n", x, y);
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
x : y : 降順: x = 1604377968, y = 32766