So I've read the documentation for calloc
and it says that it will initialize n
objects of size size
and initialize each of them to 0.
So before making my implementation of a generic dynamic array in C I decided to make it with int
type to make things simpler. I used to call calloc
and every integer in the buffer would be initialized as 0
meaning an empty space. But when I changed the data buffer from int *buffer
to void **buffer
I've been wondering if this properly initializes every void pointer to NULL
. I've seen NULL
being cast to 0
if you do int a = NULL
but does void *p = 0
the same as void *p = NULL
? And is this what calloc
actually does?