Can anyone explain what is meant by alignment in data structure in C
language. What happens internally by changing the align value. Thanks
in advance. Russell
You don't get to change the alignment. Only a compiler implementor
does.
Alignment is a requirement that certain data types must be stored
at an address that is a multiple of some constant for that type,
due to hardware requirements (if you violate them, you get some
kind of exception) or optimization (aligning doubles to a multiple
of, say, 4 speeds up loading them from memory). For example, a
data type of size 4 bytes might be aligned to a multiple of 4 bytes.
Different alignment requirements sometimes mean different sizes for
the same structure on different machines, and differing amounts of
padding between elements.
Gordon L. Burditt