I\'m getting this error:
warning: incompatible implicit declaration of built-in function ‘malloc’
I am trying to do this:
<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)
.
The stdlib.h file contains the header information or prototype of the malloc, calloc, realloc and free functions.
So to avoid this warning in ANSI C, you should include the stdlib header file.
You're missing #include <stdlib.h>
.
You likely forgot to include <stdlib.h>
.
The only solution for such warnings is to include stdlib.h in the program.