fork(1) download
  1. #include <stdio.h>
  2.  
  3. void swap(int *a,int *b);
  4. void sort(int *a,int *b);
  5. int main(void) {
  6. // your code goes here
  7. int a,b;
  8. scanf("%d%d",&a,&b);
  9. sort(&a,&b);
  10. return 0;
  11. }
  12.  
  13. void swap(int *a,int *b){
  14.  
  15. if(*a > *b){
  16. int w;
  17. w = *a;
  18. *a = *b;
  19. *b = w;
  20. }
  21.  
  22. }
  23. void sort(int *a,int *b){
  24.  
  25. swap(&a,&b);
  26. printf("(左から小さい順) a = %d b = %d",a,b);
  27.  
  28. }
  29.  
Success #stdin #stdout 0s 5308KB
stdin
3
5
stdout
(左から小さい順) a = 1858513936 b = 1858513940