fork download
  1. #include <stdio.h>
  2.  
  3. int SIZE = 15;
  4. int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
  5.  
  6.  
  7. void print_data()
  8. {
  9. int i;
  10.  
  11. for(i = 0; i < SIZE; i++)
  12. printf(" %d ", L[i]);
  13. printf("\n");
  14. }
  15.  
  16. void sort()
  17. {
  18. for(int i=0; i < SIZE-1; i++){
  19. for(int j=0; j < SIZE-1-i; j++){
  20. if(L[j] > L[j+1]){
  21. int temp = L[j];
  22. L[j] = L[j+1];
  23. L[j+1] = temp;
  24. }
  25. }
  26. }
  27. }
  28.  
  29. void main()
  30. {
  31. printf("Input Data : ");
  32. print_data();
  33.  
  34. /* sort the elements of array L[] in ascending order */
  35. sort();
  36.  
  37. printf("\n\nSorted Data : ");
  38. print_data();
  39.  
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:4:5: error: variably modified ‘L’ at file scope
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
     ^
prog.c:4:21: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                     ^
prog.c:4:21: note: (near initialization for ‘L’)
prog.c:4:24: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                        ^
prog.c:4:24: note: (near initialization for ‘L’)
prog.c:4:27: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                           ^
prog.c:4:27: note: (near initialization for ‘L’)
prog.c:4:30: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                              ^
prog.c:4:30: note: (near initialization for ‘L’)
prog.c:4:34: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                  ^~
prog.c:4:34: note: (near initialization for ‘L’)
prog.c:4:38: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                      ^~
prog.c:4:38: note: (near initialization for ‘L’)
prog.c:4:42: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                          ^~
prog.c:4:42: note: (near initialization for ‘L’)
prog.c:4:46: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                              ^
prog.c:4:46: note: (near initialization for ‘L’)
prog.c:4:49: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                 ^
prog.c:4:49: note: (near initialization for ‘L’)
prog.c:4:52: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                    ^
prog.c:4:52: note: (near initialization for ‘L’)
prog.c:4:55: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                       ^
prog.c:4:55: note: (near initialization for ‘L’)
prog.c:4:58: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                          ^
prog.c:4:58: note: (near initialization for ‘L’)
prog.c:4:61: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                             ^~
prog.c:4:61: note: (near initialization for ‘L’)
prog.c:4:65: warning: excess elements in array initializer
 int L[SIZE] = { 10, 4, 7, 1, -2, 12, 28, 66, 9, 3, 5, 7, 6, 21, 11 };
                                                                 ^~
prog.c:4:65: note: (near initialization for ‘L’)
prog.c:29:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main()
      ^~~~
stdout
Standard output is empty