What is the difference between malloc() and calloc()?
C Programming Language > Dynamic Memory Allocation > calloc() and free()
956
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. |
This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.