Some important difference between calloc and malloc are given below:
malloc:
malloc takes only the “size” of the memory block to be allocated as input parameter.
malloc allocates memory as a single contiguous block.
if a single contiguous block cannot be allocated then malloc would fail.
calloc:
calloc takes two parameters: the number of memory blocks and the size of each block of memory
calloc allocates memory which may/may not be contiguous.
all the memory blocks are initialized to 0.
it follows from point 2 that, calloc will not fail if memory can be allocated in non-contiguous blocks when a single contiguous block cannot be allocated.