What function is used in C to allocate a block of memory for an array of elements, initialize them to zero, and then return a pointer to the memory?
- alloc
- calloc
- malloc
- realloc
The calloc function in C is used to allocate a block of memory for an array of elements, initializes them to zero, and returns a pointer to the memory. It is especially useful for dynamic memory allocation.
Loading...
Related Quiz
- What happens when realloc is called with a size parameter of zero?
- In C programming, why would you use an enumeration (enum)?
- Which statement is true regarding the difference between inline functions and macros in C?
- When declaring a string literal in C, which character is automatically appended at the end?
- What is the purpose of the 'break' statement within a loop?