Record Detail

Compile Error

/in/inDictionary.c: In function 'main':
/in/inDictionary.c:8:9: error: statement with no effect [-Werror=unused-value]
  for (i <= argc; i++;) {
       ~~^~~~~~~
/in/inDictionary.c:9:22: error: subscripted value is neither array nor pointer nor vector
   char* target = argc[i];
                      ^
/in/inDictionary.c:10:14: error: passing argument 1 of 'strstr' makes pointer from integer without a cast [-Werror=int-conversion]
   if (strstr(*str, *target) == 0) {
              ^
In file included from /in/inDictionary.c:2:0:
/usr/include/string.h:329:14: note: expected 'const char *' but argument is of type 'char'
 extern char *strstr (const char *__haystack, const char *__needle)
              ^~~~~~
/in/inDictionary.c:10:20: error: passing argument 2 of 'strstr' makes pointer from integer without a cast [-Werror=int-conversion]
   if (strstr(*str, *target) == 0) {
                    ^
In file included from /in/inDictionary.c:2:0:
/usr/include/string.h:329:14: note: expected 'const char *' but argument is of type 'char'
 extern char *strstr (const char *__haystack, const char *__needle)
              ^~~~~~
/in/inDictionary.c:13:13: error: lvalue required as left operand of assignment
    *str + n = *target;
             ^
/in/inDictionary.c:4:26: error: unused parameter 'argv' [-Werror=unused-parameter]
 int main(int argc, char* argv[]) {
                          ^~~~
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Problem
mid2 ex1
Homework
Mid2
Language
C
Submit At
2023-07-13 15:36:23
Judged At
2023-08-05 22:15:13
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes