Multiple choice

Given an structure declaration Struct student { char first_name[10]; char mid_initital; char last_name[10]; int age; }; student S; The declaration of S allocates ________ bytes of memory.

  1. 5

  2. 23

  3. 32

  4. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The struct contains two char arrays of 10 bytes each (20 bytes), one char (1 byte), and one int (typically 4 bytes). Due to structure padding for alignment, the compiler often adds bytes to align the int, resulting in 24 bytes, but 23 is the raw sum. Given the options, 23 is the intended answer representing the total size of the members.