Record Detail

Compile Error

/in/ex1.c: In function 'main':
/in/ex1.c:9:24: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion]
  p = malloc((argc - 1) * sizeof(int));
                        ^
/in/ex1.c:14:12: error: expected ')' before ';' token
     count++;
            ^
/in/ex1.c:15:4: error: expected expression before '}' token
    }
    ^
/in/ex1.c:17:9: error: 'i' undeclared (first use in this function)
   *(p + i - 1) = count;
         ^
/in/ex1.c:17:9: note: each undeclared identifier is reported only once for each function it appears in
/in/ex1.c:17:18: error: 'count' undeclared (first use in this function)
   *(p + i - 1) = count;
                  ^~~~~
/in/ex1.c:7:26: error: unused parameter 'argv' [-Werror=unused-parameter]
 int main(int argc, char* argv[]) {
                          ^~~~
/in/ex1.c: At top level:
/in/ex1.c:19:10: error: implicit declaration of function 'max'; did you mean 'main'? [-Werror=implicit-function-declaration]
  int t = max(p);
          ^~~
          main
/in/ex1.c:19:14: error: 'p' undeclared here (not in a function)
  int t = max(p);
              ^
/in/ex1.c:20:2: error: expected identifier or '(' before 'return'
  return t;
  ^~~~~~
/in/ex1.c:21:1: error: expected identifier or '(' 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:44:54
Judged At
2022-07-08 16:04:48
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes