fork(1) download
  1. #include<stdio.h>
  2.  
  3. void deascend(int *x, int *y, int *z);
  4. void swap(int *a, int *b);
  5.  
  6. int main(void)
  7. {
  8. int n1,n2,n3;
  9.  
  10. printf("n1:"); scanf("%d", &n1);
  11. printf("n2:"); scanf("%d", &n2);
  12. printf("n3:"); scanf("%d", &n3);
  13.  
  14. deascend(&n1,&n2,&n3);
  15.  
  16. printf("%d, %d, %d\n", n1, n2, n3);
  17.  
  18. return 0;
  19. }
  20.  
  21. void deascend(int *x, int *y, int *z)
  22. {
  23. if(*x<*y)
  24. {
  25. if(*y<*z){swap(&x,&z);}
  26. else if(*z>*x){​swap(&x,&y);}
  27. else{
  28. swap(&x,&y);
  29. swap(&x,&z);
  30. }
  31. }
  32. else if(*y<*x)
  33. {
  34. if(*x<*z){
  35. swap(&x,&z);
  36. swap(&y,&x);
  37. }
  38. else if(*y>*z) swap(&y,&z);
  39. }
  40. }
  41.  
  42. void swap(int *a, int *b)
  43. {
  44. int w;
  45.  
  46. w = *a;
  47. *a = *b;
  48. *b = w;
  49. }
  50.  
Compilation error #stdin compilation error #stdout 0s 5512KB
stdin
compilation info
prog.c: In function ‘deascend’:
prog.c:25:32: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                 if(*y<*z){swap(&x,&z);}
                                ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:25:35: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                 if(*y<*z){swap(&x,&z);}
                                   ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:26:32: error: stray ‘\342’ in program
                 else if(*z>*x){​swap(&x,&y);}
                                ^
prog.c:26:33: error: stray ‘\200’ in program
                 else if(*z>*x){​swap(&x,&y);}
                                 ^
prog.c:26:34: error: stray ‘\213’ in program
                 else if(*z>*x){​swap(&x,&y);}
                                  ^
prog.c:26:40: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                 else if(*z>*x){​swap(&x,&y);}
                                        ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:26:43: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                 else if(*z>*x){​swap(&x,&y);}
                                           ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:28:32: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                           swap(&x,&y);
                                ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:28:35: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                           swap(&x,&y);
                                   ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:29:32: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                           swap(&x,&z);
                                ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:29:35: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                           swap(&x,&z);
                                   ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:31:9: error: stray ‘\342’ in program
         ​}
         ^
prog.c:31:10: error: stray ‘\200’ in program
         ​}
          ^
prog.c:31:11: error: stray ‘\213’ in program
         ​}
           ^
prog.c:32:9: error: stray ‘\342’ in program
         ​else if(*y<*x)
         ^
prog.c:32:10: error: stray ‘\200’ in program
         ​else if(*y<*x)
          ^
prog.c:32:11: error: stray ‘\213’ in program
         ​else if(*y<*x)
           ^
prog.c:33:9: error: stray ‘\342’ in program
         ​{
         ^
prog.c:33:10: error: stray ‘\200’ in program
         ​{
          ^
prog.c:33:11: error: stray ‘\213’ in program
         ​{
           ^
prog.c:34:16: error: stray ‘\342’ in program
                ​if(*x<*z){
                ^
prog.c:34:17: error: stray ‘\200’ in program
                ​if(*x<*z){
                 ^
prog.c:34:18: error: stray ‘\213’ in program
                ​if(*x<*z){
                  ^
prog.c:35:26: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                     swap(&x,&z);
                          ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:35:29: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                     swap(&x,&z);
                             ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:36:26: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                     swap(&y,&x);
                          ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:36:29: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                     swap(&y,&x);
                             ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c:38:16: error: stray ‘\342’ in program
                ​else if(*y>*z)  swap(&y,&z);
                ^
prog.c:38:17: error: stray ‘\200’ in program
                ​else if(*y>*z)  swap(&y,&z);
                 ^
prog.c:38:18: error: stray ‘\213’ in program
                ​else if(*y>*z)  swap(&y,&z);
                  ^
prog.c:38:40: warning: passing argument 1 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                ​else if(*y>*z)  swap(&y,&z);
                                        ^~
prog.c:4:16: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
           ~~~~~^
prog.c:38:43: warning: passing argument 2 of ‘swap’ from incompatible pointer type [-Wincompatible-pointer-types]
                ​else if(*y>*z)  swap(&y,&z);
                                           ^~
prog.c:4:24: note: expected ‘int *’ but argument is of type ‘int **’
 void swap(int *a, int *b);
                   ~~~~~^
prog.c: In function ‘main’:
prog.c:10:20: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     printf("n1:"); scanf("%d", &n1);
                    ^~~~~~~~~~~~~~~~
prog.c:11:20: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     printf("n2:"); scanf("%d", &n2);
                    ^~~~~~~~~~~~~~~~
prog.c:12:20: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     printf("n3:"); scanf("%d", &n3);
                    ^~~~~~~~~~~~~~~~
stdout
Standard output is empty