Calloc()

Malloc()

Calloc initializes the allocated memory to Null or Zero. Malloc initializes the allocated memory area with garbage value.
 Block of memory is allocated by Calloc().  Byte of memory is allocated by Malloc().
Calloc()  takes two arguments i.e. number of variables to
allocate memory and size of bytes of a single variable.
Syntax :
” void *calloc (no._of_blocks, Size_of_each_block_in_bytes); “
Malloc() takes one argument i.e. the size of memory.
Syntax :
“void *malloc (size_in_bytes); “
Calloc() performs the memory initialization. Malloc() does not perform initialization of memory.
Calloc is bit slower than Malloc() as it initializes the allocated memory to Null or Zero. Malloc() is bit faster than Calloc() as it does not take extra step to initialize the allocated memory.
Calloc() returns a pointer to memory with allocating the contiguous storage of specified size of each byte Malloc() returns a pointer to the first byte of the allocated space.

It is better to use Calloc() than Malloc() as it’s allocated memory’s content is unpredictable.