Record Detail

Compile Error

/in/ex1.c: In function 'countExtenMax':
/in/ex1.c:7:2: error: parameter 'fileNums' is initialized
  int fileNums = sizeof(input)/sizeof(input[0]);  //Count number of files
  ^~~
/in/ex1.c:7:24: error: 'input' undeclared (first use in this function); did you mean 'int'?
  int fileNums = sizeof(input)/sizeof(input[0]);  //Count number of files
                        ^~~~~
                        int
/in/ex1.c:7:24: note: each undeclared identifier is reported only once for each function it appears in
/in/ex1.c:6:5: error: old-style parameter declarations in prototyped function definition
 int countExtenMax(int input)  //Determine the number of extensions
     ^~~~~~~~~~~~~
/in/ex1.c:8:21: error: 'fileNums' undeclared (first use in this function)
 { for (int i=0; i < fileNums; i++)  //Identify each file exntension and make a number count of it   
                     ^~~~~~~~
/in/ex1.c:9:16: error: subscripted value is neither array nor pointer nor vector
  { switch(input[i])      //Identify each file extension and tally a number for each extension
                ^
/in/ex1.c:11:9: error: implicit declaration of function 'strcmp' [-Werror=implicit-function-declaration]
    case strcmp(input[i]), .txt):
         ^~~~~~
/in/ex1.c:11:21: error: subscripted value is neither array nor pointer nor vector
    case strcmp(input[i]), .txt):
                     ^
/in/ex1.c:11:25: error: expected ':' or '...' before ',' token
    case strcmp(input[i]), .txt):
                         ^
/in/ex1.c:11:25: error: expected expression before ',' token
/in/ex1.c:11:25: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
/in/ex1.c:11:31: error: expected statement before ')' token
    case strcmp(input[i]), .txt):
                               ^
/in/ex1.c:11:32: error: expected expression before ':' token
    case strcmp(input[i]), .txt):
                                ^
/in/ex1.c:14:4: error: expected ';' before 'case'
    case strcmp(input[i]]), .cpp):
    ^~~~
/in/ex1.c:14:25: error: expected statement before ')' token
    case strcmp(input[i]]), .cpp):
                         ^
/in/ex1.c:14:26: error: expected expression before ',' token
    case strcmp(input[i]]), .cpp):
                          ^
/in/ex1.c:14:26: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
/in/ex1.c:14:32: error: expected statement before ')' token
    case strcmp(input[i]]), .cpp):
                                ^
/in/ex1.c:14:33: error: expected expression before ':' token
    case strcmp(input[i]]), .cpp):
                                 ^
/in/ex1.c:17:4: error: expected ';' before 'case'
    case strcmp(input[i]), .doc):
    ^~~~
/in/ex1.c:17:31: error: expected statement before ')' token
    case strcmp(input[i]), .doc):
                               ^
/in/ex1.c:17:32: error: expected expression before ':' token
    case strcmp(input[i]), .doc):
                                ^
/in/ex1.c:20:4: error: expected ';' before 'case'
    case strcmp(input[i]]), .pptx):
    ^~~~
/in/ex1.c:20:25: error: expected statement before ')' token
    case strcmp(input[i]]), .pptx):
                         ^
/in/ex1.c:20:26: error: expected expression before ',' token
    case strcmp(input[i]]), .pptx):
                          ^
/in/ex1.c:20:26: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
/in/ex1.c:20:33: error: expected statement before ')' token
    case strcmp(input[i]]), .pptx):
                                 ^
/in/ex1.c:20:34: error: expected expression before ':' token
    case strcmp(input[i]]), .pptx):
                                  ^
/in/ex1.c:23:3: error: expected ';' before '}' token
   }
   ^
/in/ex1.c:25:6: error: 'txtNum' undeclared (first use in this function)
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
      ^~~~~~
/in/ex1.c:25:16: error: 'cppNum' undeclared (first use in this function); did you mean 'txtNum'?
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
                ^~~~~~
                txtNum
/in/ex1.c:25:35: error: 'docNum' undeclared (first use in this function); did you mean 'cppNum'?
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
                                   ^~~~~~
                                   cppNum
/in/ex1.c:25:53: error: 'pptxNum' undeclared (first use in this function); did you mean 'cppNum'?
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
                                                     ^~~~~~~
                                                     cppNum
/in/ex1.c:25:61: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
                                                             ^
/in/ex1.c:25:2: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
  if (txtNum >= cppNum && txtNum>= docNum && txtNum>=pptxNum);   //Determine highest number of extensions
  ^~
/in/ex1.c:26:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   int maxExtNum = txtnum;
   ^~~
/in/ex1.c:26:19: error: 'txtnum' undeclared (first use in this function); did you mean 'txtNum'?
   int maxExtNum = txtnum;
                   ^~~~~~
                   txtNum
/in/ex1.c:27:2: error: 'else' without a previous 'if'
  else if (cppNum >= txtNum && cppNum>= docNum && cppNum>=pptxNum);
  ^~~~
/in/ex1.c:27:66: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  else if (cppNum >= txtNum && cppNum>= docNum && cppNum>=pptxNum);
                                                                  ^
/in/ex1.c:27:7: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
  else if (cppNum >= txtNum && cppNum>= docNum && cppNum>=pptxNum);
       ^~
/in/ex1.c:28:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   int maxExtNum= cppNum;
   ^~~
/in/ex1.c:28:7: error: redefinition of 'maxExtNum'
   int maxExtNum= cppNum;
       ^~~~~~~~~
/in/ex1.c:26:7: note: previous definition of 'maxExtNum' was here
   int maxExtNum = txtnum;
       ^~~~~~~~~
/in/ex1.c:29:2: error: 'else' without a previous 'if'
  else if (docNum >= txtNum && docNum>= cppNum && docNum>=pptxNum);
  ^~~~
/in/ex1.c:29:66: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  else if (docNum >= txtNum && docNum>= cppNum && docNum>=pptxNum);
                                                                  ^
/in/ex1.c:29:7: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
  else if (docNum >= txtNum && docNum>= cppNum && docNum>=pptxNum);
       ^~
/in/ex1.c:30:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   int maxExtNum= docNum;
   ^~~
/in/ex1.c:30:7: error: redefinition of 'maxExtNum'
   int maxExtNum= docNum;
       ^~~~~~~~~
/in/ex1.c:28:7: note: previous definition of 'maxExtNum' was here
   int maxExtNum= cppNum;
       ^~~~~~~~~
/in/ex1.c:31:2: error: 'else' without a previous 'if'
  else if (pptxNum >= txtNum && pptxNum>= docNum && pptxNum>=docNum);
  ^~~~
/in/ex1.c:31:68: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  else if (pptxNum >= txtNum && pptxNum>= docNum && pptxNum>=docNum);
                                                                    ^
/in/ex1.c:31:7: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
  else if (pptxNum >= txtNum && pptxNum>= docNum && pptxNum>=docNum);
       ^~
/in/ex1.c:32:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   int maxExtNum= pptxNum;
   ^~~
/in/ex1.c:32:7: error: redefinition of 'maxExtNum'
   int maxExtNum= pptxNum;
       ^~~~~~~~~
/in/ex1.c:30:7: note: previous definition of 'maxExtNum' was here
   int maxExtNum= docNum;
       ^~~~~~~~~
/in/ex1.c:34:1: error: expected ';' before '}' token
 }
 ^
/in/ex1.c:6:23: error: parameter 'input' set but not used [-Werror=unused-but-set-parameter]
 int countExtenMax(int input)  //Determine the number of extensions
                       ^~~~~
/in/ex1.c: In function 'main':
/in/ex1.c:37:7: error: array size missing in 'filenames'
  char filenames[];    //Scan for filename inputs
       ^~~~~~~~~
/in/ex1.c:38:10: error: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[1]' [-Werror=format=]
  scanf("%s" , &filenames);
         ~^    ~~~~~~~~~~
/in/ex1.c:41:31: error: passing argument 1 of 'countExtenMax' makes integer from pointer without a cast [-Werror=int-conversion]
  int extenNum = countExtenMax(filenames); //Function for counting extensions and finding max extension number
                               ^~~~~~~~~
/in/ex1.c:6:5: note: expected 'int' but argument is of type 'char *'
 int countExtenMax(int input)  //Determine the number of extensions
     ^~~~~~~~~~~~~
/in/ex1.c:48:1: error: expected ';' before '}' token
 }
 ^
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Problem
Mid2 Ex1
Homework
Midterm Exam 2
Language
C
Submit At
2022-07-07 15:14:02
Judged At
2022-07-08 16:06:04
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes