🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.p.age
  2. B.p->age
  3. C.*p.age
  4. 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 →