🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Dynamic Memory: all 10 questions

Quiz: Dynamic Memory · Question 1 of 10

Which function allocates memory AND sets it to zero?

Which function allocates memory AND sets it to zero?

  1. A.malloc
  2. B.calloc
  3. C.realloc
  4. D.free
Answer & explanation

Correct answer: calloc

calloc zero-initialises; malloc leaves garbage.

Can you get the rest right without peeking?

Take the timed Quiz: Dynamic Memory quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →