Use the alignment attribute to specify how to align a member in a structure.
For example, the following structure member definition aligns all definitions of struct S3 on an 8-byte boundary, where a is at offset 0 and b is at offset 8.
struct S3 {
char a;
int b __attribute__ ((aligned (8)));
};
struct S3 s3;
The following struct member definition aligns all definitions of struct S4 on a 4-byte boundary, where a is at offset 0 and b is at offset 4.
struct S4 {
char a;
int b __attribute__ ((aligned (2)));
};
struct S4 s4;