1.

Which of the following functions allocates multiple blocks of memory, each block of the same size?(a) malloc()(b) realloc()(c) calloc()(d) free()I had been asked this question in a job interview.My question is from DMA Functions, Memory Leak, Dangling Pointers in section Dynamic Memory Allocation in C of C

Answer»

Correct option is (c) calloc()

The BEST explanation: MALLOC() ALLOCATES a single block of MEMORY WHEREAS calloc() allocates multiple blocks of memory, each block with the same size.



Discussion

No Comment Found

Related InterviewSolutions