Record Detail

Compile Error

/in/ex6.c: In function 'removeBook':
/in/ex6.c:6:11: error: invalid operands to binary == (have 'book {aka struct book}' and 'void *')
     if(cur==NULL){
           ^~
/in/ex6.c:9:16: error: invalid type argument of '->' (have 'book {aka struct book}')
     else if(cur->number==number){
                ^~
/in/ex6.c:10:16: error: invalid type argument of '->' (have 'book {aka struct book}')
         (*head)->next=cur->next;
                ^~
/in/ex6.c:10:26: error: invalid type argument of '->' (have 'book {aka struct book}')
         (*head)->next=cur->next;
                          ^~
/in/ex6.c:11:9: error: implicit declaration of function 'free' [-Werror=implicit-function-declaration]
         free(cur);
         ^~~~
/in/ex6.c:11:9: error: incompatible implicit declaration of built-in function 'free' [-Werror]
/in/ex6.c:11:9: note: include '<stdlib.h>' or provide a declaration of 'free'
/in/ex6.c:11:14: error: incompatible type for argument 1 of 'free'
         free(cur);
              ^~~
/in/ex6.c:11:14: note: expected 'void *' but argument is of type 'book {aka struct book}'
/in/ex6.c:15:15: error: used struct type value where scalar is required
         while(cur){
               ^~~
/in/ex6.c:16:19: error: invalid type argument of '->' (have 'book {aka struct book}')
             if(cur->number==number){
                   ^~
/in/ex6.c:17:20: error: invalid type argument of '->' (have 'book {aka struct book}')
                 pre->next=next;
                    ^~
/in/ex6.c:17:27: error: 'next' undeclared (first use in this function)
                 pre->next=next;
                           ^~~~
/in/ex6.c:17:27: note: each undeclared identifier is reported only once for each function it appears in
/in/ex6.c:18:17: error: incompatible implicit declaration of built-in function 'free' [-Werror]
                 free(cur);
                 ^~~~
/in/ex6.c:18:17: note: include '<stdlib.h>' or provide a declaration of 'free'
/in/ex6.c:18:22: error: incompatible type for argument 1 of 'free'
                 free(cur);
                      ^~~
/in/ex6.c:18:22: note: expected 'void *' but argument is of type 'book {aka struct book}'
/in/ex6.c:22:20: error: invalid type argument of '->' (have 'book {aka struct book}')
             cur=cur->next;
                    ^~
/in/ex6.c:24:15: error: invalid operands to binary == (have 'book {aka struct book}' and 'void *')
         if(cur==NULL){
               ^~
/in/ex6.c:29:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Midterm Exam 2
Language
C
Submit At
2022-07-07 15:26:51
Judged At
2022-07-08 16:04:59
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes