What is the difference between "calloc(...)" and "malloc(...)"?
Some important distance between calloc and malloc are given below:
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 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 beallocated in non-contiguous blocks when a single contiguous blockcannot be allocated.