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