Q: Why am I getting ``warning: assignment of pointer from integer lacks a cast'' for calls to malloc?
A: Have you #included <stdlib.h>, or otherwise arranged for malloc to be declared properly? If not, the compiler assumes that it returns an int (see question 1.25), which is not correct. (The same problem could arise for calloc or realloc.) See also question 7.15.
H&S Sec. 4.7 p. 101