MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Structures, Unions & Enums
Beginner
Q
On a typical 32-bit or 64-bit system, what is sizeof(struct { char c; int i; })?
A4
B5
C8
D6
Correct Answer:
C. 8
Explanation:
The compiler inserts 3 padding bytes after c so that i is aligned on a 4-byte boundary.
ALSO KNOW (related points):
• What is the size of a union? → At least the size of its largest member (plus any alignment padding), because all members share the same memory