fork download
  1. /*ONJ PROGRAMMING CLUB var6.00*/
  2. /*QUIZMASTER ID rzH*/
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7.  
  8. int main(void)
  9. {
  10. char ***str={
  11. {"A-1","A-2","A-3"},
  12. {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
  13. {"C-1","C-2","C-3","C-4","C-5"},
  14. {"D-1","D-2","D-3","D-4"}};
  15.  
  16. int i=0;
  17. int j=0;
  18. int k=0;
  19. int str_random[5];
  20. int r;
  21. int cnt;
  22.  
  23. srand((unsigned)time(NULL));
  24.  
  25. for( i=0 ; i<10 ; i++ )
  26. {
  27. cnt = j = 0;
  28.  
  29. while( cnt < 5 )
  30. {
  31. r = rand();
  32.  
  33. if( cnt == 2 )
  34. {
  35. j--;
  36. }
  37.  
  38. if( r > sizeof(str[j][0])/sizeof(str[j][0][0]) )
  39. {
  40. continue;
  41. }
  42.  
  43. str_random[cnt] = r;
  44. j++;
  45. cnt;
  46. }
  47.  
  48. printf("%s%sha%swo%s%s¥n",str[0][str_random[0]],str[1][str_random[1]],str[1][str_random[2]],str[2][str_random[3]],str[3][str_random[4]]};
  49. }
  50.  
  51. return 0;
  52. }
  53.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:11:9: warning: braces around scalar initializer
         {"A-1","A-2","A-3"},
         ^
prog.c:11:9: note: (near initialization for ‘str’)
prog.c:11:10: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
         {"A-1","A-2","A-3"},
          ^~~~~
prog.c:11:10: note: (near initialization for ‘str’)
prog.c:11:16: warning: excess elements in scalar initializer
         {"A-1","A-2","A-3"},
                ^~~~~
prog.c:11:16: note: (near initialization for ‘str’)
prog.c:11:22: warning: excess elements in scalar initializer
         {"A-1","A-2","A-3"},
                      ^~~~~
prog.c:11:22: note: (near initialization for ‘str’)
prog.c:12:9: warning: braces around scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
         ^
prog.c:12:9: note: (near initialization for ‘str’)
prog.c:12:10: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
          ^~~~~
prog.c:12:10: note: (near initialization for ‘str’)
prog.c:12:16: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                ^~~~~
prog.c:12:16: note: (near initialization for ‘str’)
prog.c:12:22: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                      ^~~~~
prog.c:12:22: note: (near initialization for ‘str’)
prog.c:12:28: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                            ^~~~~
prog.c:12:28: note: (near initialization for ‘str’)
prog.c:12:34: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                                  ^~~~~
prog.c:12:34: note: (near initialization for ‘str’)
prog.c:12:40: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                                        ^~~~~
prog.c:12:40: note: (near initialization for ‘str’)
prog.c:12:46: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                                              ^~~~~
prog.c:12:46: note: (near initialization for ‘str’)
prog.c:12:52: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
                                                    ^~~~~
prog.c:12:52: note: (near initialization for ‘str’)
prog.c:12:9: warning: excess elements in scalar initializer
         {"B-1","B-2","B-3","B-4","B-5","B-6","B-7","B-8"},
         ^
prog.c:12:9: note: (near initialization for ‘str’)
prog.c:13:9: warning: braces around scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
         ^
prog.c:13:9: note: (near initialization for ‘str’)
prog.c:13:10: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
         {"C-1","C-2","C-3","C-4","C-5"},
          ^~~~~
prog.c:13:10: note: (near initialization for ‘str’)
prog.c:13:16: warning: excess elements in scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
                ^~~~~
prog.c:13:16: note: (near initialization for ‘str’)
prog.c:13:22: warning: excess elements in scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
                      ^~~~~
prog.c:13:22: note: (near initialization for ‘str’)
prog.c:13:28: warning: excess elements in scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
                            ^~~~~
prog.c:13:28: note: (near initialization for ‘str’)
prog.c:13:34: warning: excess elements in scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
                                  ^~~~~
prog.c:13:34: note: (near initialization for ‘str’)
prog.c:13:9: warning: excess elements in scalar initializer
         {"C-1","C-2","C-3","C-4","C-5"},
         ^
prog.c:13:9: note: (near initialization for ‘str’)
prog.c:14:9: warning: braces around scalar initializer
         {"D-1","D-2","D-3","D-4"}};
         ^
prog.c:14:9: note: (near initialization for ‘str’)
prog.c:14:10: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
         {"D-1","D-2","D-3","D-4"}};
          ^~~~~
prog.c:14:10: note: (near initialization for ‘str’)
prog.c:14:16: warning: excess elements in scalar initializer
         {"D-1","D-2","D-3","D-4"}};
                ^~~~~
prog.c:14:16: note: (near initialization for ‘str’)
prog.c:14:22: warning: excess elements in scalar initializer
         {"D-1","D-2","D-3","D-4"}};
                      ^~~~~
prog.c:14:22: note: (near initialization for ‘str’)
prog.c:14:28: warning: excess elements in scalar initializer
         {"D-1","D-2","D-3","D-4"}};
                            ^~~~~
prog.c:14:28: note: (near initialization for ‘str’)
prog.c:14:9: warning: excess elements in scalar initializer
         {"D-1","D-2","D-3","D-4"}};
         ^
prog.c:14:9: note: (near initialization for ‘str’)
prog.c:45:13: warning: statement with no effect [-Wunused-value]
             cnt;
             ^~~
prog.c:48:145: error: expected ‘)’ before ‘}’ token
         printf("%s%sha%swo%s%s¥n",str[0][str_random[0]],str[1][str_random[1]],str[1][str_random[2]],str[2][str_random[3]],str[3][str_random[4]]};
                                                                                                                                                 ^
prog.c:48:145: error: expected ‘;’ before ‘}’ token
prog.c:18:9: warning: unused variable ‘k’ [-Wunused-variable]
     int k=0;
         ^
prog.c: At top level:
prog.c:51:4: error: expected identifier or ‘(’ before ‘return’
    return 0;
    ^~~~~~
prog.c:52:1: error: expected identifier or ‘(’ before ‘}’ token
 }
 ^
stdout
Standard output is empty