1. Home
  2. Computer Science MCQs
  3. C Programming
  4. How does calloc differ from malloc?

Added 30 Nov -0001

How does calloc differ from malloc?

  1. calloc leaves the block uninitialised
  2. calloc zero-fills the allocated block Correct answer
  3. calloc places the block on the stack
  4. calloc resizes an existing block

Correct answer

B. calloc zero-fills the allocated block

13 views

MCQSEXAM

Explanation

calloc allocates and sets every byte to zero, whereas malloc leaves the memory uninitialised.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C Programming MCQs

Practise all C Programming MCQs

Similar MCQs