In C, the function ________ is used to allocate memory for an array of elements and initialize them to zero.
- calloc()
- free()
- malloc()
- realloc()
In C, the function calloc() is used to allocate memory for an array of elements and initialize them to zero. Unlike malloc(), it automatically initializes the memory to zero, making it useful for arrays. realloc() is used to resize memory, and free() deallocates memory.
Loading...
Related Quiz
- What is a double pointer in C?
- You're writing a program that needs to efficiently calculate the power of 2 for a given exponent. Which operator would be most efficient to use?
- The function ________ is used to close a file in C.
- What is the primary cause of memory leaks in a C program?
- In a program that processes large amounts of data, what strategy can be used to optimize the performance of loops?