What is the difference between malloc() and calloc()?

Fill In The Blank
Views 875

Answer:

Issues  calloc() malloc()
Description The malloc() function allocates a single block of requested memory. The calloc() function allocates multiple blocks of requested memory.
Initialization It initializes the content of the memory to zero. It does not initialize the content of memory, so it carries the garbage value.
Number of arguments It consists of two arguments. It consists of only one argument.
Return value It returns a pointer pointing to the allocated memory. It returns a pointer pointing to the allocated memory.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of C Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.