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

Quiz: C Pointers · Question 10 of 10

Why must a void be cast to a typed pointer before you dereference it?

Why must a void * be cast to a typed pointer before you dereference it?

  1. A.void pointers are always NULL
  2. B.The compiler does not know the type, so it does not know how many bytes to read or how to interpret them
  3. C.void pointers point to functions only
  4. D.Casting makes the pointer faster
Answer & explanation

Correct answer: The compiler does not know the type, so it does not know how many bytes to read or how to interpret them

A void * is a generic address; the cast says what kind of value lives there.

Can you get the rest right without peeking?

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

Start the quiz →