prev up next   top/contents search

comp.lang.c FAQ list · Question 2.13

Q: Why does sizeof report a larger size than I expect for a structure type, as if there were padding at the end?


A: Padding at the end of a structure may be necessary to preserve alignment when an array of contiguous structures is allocated. Even when the structure is not part of an array, the padding remains, so that sizeof can always return a consistent size. See also question 2.12.

References: H&S Sec. 5.6.7 pp. 139-40


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North