← Quiz: Structures and Unions: all 10 questions
Quiz: Structures and Unions · Question 1 of 10
If p is a pointer to a struct, how do you access its member age?
If p is a pointer to a struct, how do you access its member age?
- A.p.age
- B.p->age
- C.*p.age
- D.p::age
Answer & explanation
Correct answer: p->age
p->age is shorthand for (*p).age. (*p.age would parse as *(p.age).)
Can you get the rest right without peeking?
Take the timed Quiz: Structures and Unions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →