A compiler might insert padding bytes to a structure to ensure that structure members appear in the correct location. Initializing the members of the structure does not always initialize the padding bytes.
The C standardC Standard, Section 6section 6.2.6.1 [ISO/IEC 9899:2011], states:
...
GCC allows specifying attributes of variables and structures using the keyword __attribute__((__packed__)). This means that that the GCC will not add any padding bytes (for memory alignment) and make variables or fields immediately next to each other.
...
ISO/IEC 9899:2011 Section 6.2.6.1, "General" (para. 6)
...
...