Incompatible implicit declaration of built-in function ‘malloc’
You likely forgot to #include <stdlib.h>
You're missing #include <stdlib.h>
.
You need to #include <stdlib.h>
. Otherwise it's defined as int malloc()
which is incompatible with the built-in type void *malloc(size_t)
.