1.

In the function realloc(), if the new size of the memory block is larger than the old size, then the added memory ___________(a) is initialized to junk values(b) is initialized to zero(c) results in an error(d) is not initializedI got this question in an online quiz.My doubt stems from DMA Functions, Memory Leak, Dangling Pointers topic in portion Dynamic Memory Allocation in C of C

Answer»

Correct answer is (d) is not initialized

To explain: The function REALLOC() changes the size of a particular memory block. If the new size is LARGER than the OLD size, the added memory is not initialized.



Discussion

No Comment Found

Related InterviewSolutions