which function allocates memory and initialise elements to 0
Answers
Answer:
The calloc() function is used in complex data structures which require larger memory space. The memory block allocated by a calloc() in C is always initialized to zero while in function malloc() in C, it always contains a garbage value.
Answer:
Calloc is the correct option
Explanation:
calloc() allocates multiple block of requested memory.
Why does calloc need to set the memory initialization value to 0?
The memory does not always need to be initialized to 0 by calloc. The space is initialized with all bits set to zero, according to the calloc definition. The memory is initialized to zero by some means, but it is not stated that calloc is the one who does this action. Malloc is not like this:
We know that the heap is a section of demand-zero memory that follows the uninitialized data region and expands upward (toward higher addresses). Demand zero signifies that the associated physical page will contain only zeros the first time the CPU interacts with a virtual page in the heap region.
calloc() function in C
- The many blocks of required memory are allotted by the calloc() function.
- All bytes are originally initialized to zero.
- If there is not enough memory, it returns NULL.
get more information about it
https://brainly.in/question/4620196
https://brainly.in/question/8471193