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