With the introduction of pointers to void *
pointers in the ANSI/ISO C Standard, explicitly casting the result of a call to malloc()
is no longer necessary and may even produce unexpected behavior if <stdlib.h>
is accidentally not included.
Non-Compliant Code Example
...
Explicitly casting the return value of malloc()
eliminates may eliminate the warning for the implicit declaration of malloc()
.
...