Er. Can anyone tell me the difference between calloc(); and malloc(); To me, it looks like they do the same thing.........
Er. Can anyone tell me the difference between calloc(); and malloc(); To me, it looks like they do the same thing.........
if my memory serves me correctly....forgive the pun..
malloc allocates a block of memory for whatever..
where as
calloc allocates a block of memory and initializes memory to NULL
if I am wrong then no doubt someone will tell me.
hoping to be certified (programming in c)
here's the news - I'm officially certified.
Yup - that is correct. The only difference is in the way memory is requested using calloc.
void *calloc( size_t num, size_t size );
void *malloc( size_t size );
But read this
http://www.eskimo.com/~scs/C-faq/q7.31.html