🎙 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 10 of 10

Why do functions usually take a pointer to a large struct, like void show(const struct Student s), rather than the stru…

Why do functions usually take a pointer to a large struct, like void show(const struct Student *s), rather than the struct itself?

  1. A.Structs cannot be passed to functions by value
  2. B.Passing by value copies the whole struct; a pointer passes only an address
  3. C.Pointers make the members public
  4. D.It is required by the -> operator
Answer & explanation

Correct answer: Passing by value copies the whole struct; a pointer passes only an address

const keeps the function from changing the caller's struct while avoiding the copy.

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 →