I am trying to understand how exactly structures work in C. More precisely, the size of a structure.
When I print the size of the following structure:
struct Test {
char tab[14];
};
I have the output 14
.
But the size of
struct Test2{
uint16_t a;
uint16_t b;
uint16_t c;
uint64_t d;
};
is equals to 16
.
I read in a previous post that there is a "padding added to satisfy alignment constraints". Then why this padding isn't apply to the first example ?