Record Detail

Compile Error

/in/vector.c: In function 'construct':
/in/vector.c:16:2: error: dereferencing pointer to incomplete type 'struct vector'
 v->size=0;
  ^~
/in/vector.c: In function 'destruct':
/in/vector.c:22:10: error: passing argument 1 of 'free' makes pointer from integer without a cast [-Werror=int-conversion]
     free(v->data);
          ^
In file included from /in/vector.c:5:0:
/usr/include/stdlib.h:563:13: note: expected 'void *' but argument is of type 'unsigned int'
 extern void free (void *__ptr) __THROW;
             ^~~~
/in/vector.c: In function 'extend':
/in/vector.c:29:17: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
         v->data = malloc(sizeof(void*) * v->size);
                 ^
/in/vector.c:30:38: error: invalid application of 'sizeof' to a void type [-Werror=pointer-arith]
         memset(v->data, '\0', sizeof(void) * v->size);
                                      ^~~~
/in/vector.c:30:16: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion]
         memset(v->data, '\0', sizeof(void) * v->size);
                ^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from /in/vector.c:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: note: expected 'void *' but argument is of type 'unsigned int'
 __NTH (memset (void *__dest, int __ch, size_t __len))
 ^
/in/vector.c: In function 'contract':
/in/vector.c:39:17: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
         v->data = malloc(sizeof(void*) * v->size);
                 ^
/in/vector.c:40:38: error: invalid application of 'sizeof' to a void type [-Werror=pointer-arith]
         memset(v->data, '\0', sizeof(void) * v->size);
                                      ^~~~
/in/vector.c:40:16: error: passing argument 1 of 'memset' makes pointer from integer without a cast [-Werror=int-conversion]
         memset(v->data, '\0', sizeof(void) * v->size);
                ^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from /in/vector.c:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: note: expected 'void *' but argument is of type 'unsigned int'
 __NTH (memset (void *__dest, int __ch, size_t __len))
 ^
/in/vector.c: In function 'push_back':
/in/vector.c:51:27: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Werror=int-conversion]
         v->data = realloc(v->data, sizeof(void*) * v->size);
                           ^
In file included from /in/vector.c:5:0:
/usr/include/stdlib.h:549:14: note: expected 'void *' but argument is of type 'unsigned int'
 extern void *realloc (void *__ptr, size_t __size)
              ^~~~~~~
/in/vector.c:51:17: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
         v->data = realloc(v->data, sizeof(void*) * v->size);
                 ^
/in/vector.c:53:12: error: subscripted value is neither array nor pointer nor vector
     v->data[v->size]=element;
            ^
/in/vector.c: In function 'pop_back':
/in/vector.c:62:27: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Werror=int-conversion]
         v->data = realloc(v->data, sizeof(void*) * v->size);
                           ^
In file included from /in/vector.c:5:0:
/usr/include/stdlib.h:549:14: note: expected 'void *' but argument is of type 'unsigned int'
 extern void *realloc (void *__ptr, size_t __size)
              ^~~~~~~
/in/vector.c:62:17: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
         v->data = realloc(v->data, sizeof(void*) * v->size);
                 ^
/in/vector.c:64:12: error: subscripted value is neither array nor pointer nor vector
     v->data[v->size]=NULL;
            ^
/in/vector.c: In function 'get':
/in/vector.c:75:9: error: 'return' with no value, in function returning non-void [-Werror]
         return;
         ^~~~~~
/in/vector.c:70:5: note: declared here
 int get(vector *v, unsigned int index)
     ^~~
/in/vector.c:78:19: error: subscripted value is neither array nor pointer nor vector
     return v->data[index];
                   ^
/in/vector.c: In function 'change':
/in/vector.c:82:19: error: 'vector {aka struct vector_t}' has no member named 'count'
     if (index >= v->count) {
                   ^~
/in/vector.c:86:12: error: subscripted value is neither array nor pointer nor vector
     v->data[index]=element;
            ^
/in/vector.c: In function 'print':
/in/vector.c:91:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < v->limit; i++)
                       ^
/in/vector.c:92:26: error: subscripted value is neither array nor pointer nor vector
     {printf("%d", v->data[i]);
                          ^
/in/vector.c: At top level:
/in/vector.c:97:1: error: expected identifier or '(' before '}' token
 }
 ^
/in/vector.c: In function 'construct':
/in/vector.c:19: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
Lab7 Quiz
Language
C
Submit At
2020-06-30 09:32:46
Judged At
2020-06-30 09:32:46
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes