Possible Duplicate:
c difference between malloc and calloc
Please explain the significance of this statement,
Another difference between the malloc() and calloc() functions is that the memory allocated by malloc( ) function contains garbage values, while memory allocated by calloc( ) function contains all zeros.
Source ('C' Programming, Salim Y. Amdani)
Thanks
From http://wiki.answers.com/Q/Is_it_better_to_use_malloc_or_calloc_to_allocate_memory
malloc()
is faster, since calloc()
initializes the allocated memory to contain all zeros. Since you typically would want to use and initialize the memory yourself, this additional benefit of calloc()
may not be necessary.