
AXC 1050 (XC)
114
PHOENIX CONTACT
8482_en_03
The size of Struct2 is calculated based on the elements used and the resulting alignment.
The corresponding number of padding bytes is inserted so that the size of the data type with
the value of the alignment can be divided by two leaving no remainder (data type size mod-
ulo alignment = 0).
Struct3 does not receive any padding bytes as the maximum alignment corresponds to one
byte.
Due to the padding byte that belongs to the Struct2 structure, the Struct3 structure starts at
an even address in Struct4.
Array1 receives two padding bytes corresponding to two consecutive Struct2 structures.
Program example without
data gaps
The following program shows an example of how to fill data gaps in your application pro-
gram. Fill data gaps, which are to be expected due to the memory alignment, with applica-
tion data (padding bytes in Figure 7-29).
Figure 7-29
Example programming with padding bytes