Q:

What is the difference between malloc and calloc?

0

What is the difference between malloc and calloc?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

A malloc and calloc are memory management functions. They are used to allocate memory dynamically. Basically, there is no actual difference between calloc and malloc except that the memory that is allocated by calloc is initialized with 0. In C language,calloc function initialize the all allocated space bits with zero but malloc does not initialize the allocated memory. These both function also has a difference regarding their number of arguments, malloc takes one argument but calloc takes two.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Is it better to use malloc () or calloc ()?... >>