Difference between malloc and calloc: Which is better to use malloc() function, or calloc() function, to allocate memory in c?
i. calloc will set all bits as 0, so go for calloc.
ii. calloc will not guarantee to initialize the pointer as null pointer, so whether you use calloc or malloc and if your data structure is having pointers, then you have to nullify those pointers programatically. Don't depend on calloc for that.
iii. its always better to use malloc.