How do malloc and calloc work?
- Malloc :- The primary function of malloc is to allocate memory at runtime. The size is taken in bytes, and correctly that much space is allocated in the memory.
- Calloc :- It is similar to malloc as it allocates memory at runtime which is defined in stdlib.h. The job of calloc is to take the number of elements, and each element size is in bytes. They will then initialize each of these elements to zero. Finally, a void pointer is returned to the memory.
Suggest An Answer
No suggestions Available!