All challenges
Multiple ChoiceIntermediate 45s

Member reordering changes sizeof

Reordering members in a struct can change `sizeof` because:
Options
  1. 1Padding is inserted to satisfy each member's alignment; ordering largest-to-smallest can reduce total padding.
  2. 2The compiler sorts the members by descending size automatically, which can change the layout.
  3. 3It cannot change; the order of members never affects struct layout or the total sizeof.
  4. 4It changes because the compiler inserts a vtable pointer at the front of ordinary structs.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle