Computer Science, asked by prakasha2, 1 year ago

What is the difference between Calloc() and Malloc() ?

Answers

Answered by kvnmurty
2
In C language we have memory allocation methods/functions called calloc() and malloc(). Memory is allocated in terms of bytes in case of malloc(). calloc function allocates in terms of multiples of some size. If we want to allocate memory for 100 structured elements or array, we use calloc. calloc has two parameters and malloc has one.




Answered by joshinrexy22
1
Calloc() takes two arguments but malloc() takes only one argument. Malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to zero .Byte of memory is allocated by malloc(), whereas block of memory is allocated by calloc().
Similar questions