← 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?
- A.void pointers are always NULL
- B.The compiler does not know the type, so it does not know how many bytes to read or how to interpret them
- C.void pointers point to functions only
- 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 →