So I have a struct in C defined as so:
struct example {
int ex1;
u_long ex2;
float ex3;
float ex4;
};
So the size of all of example's member is 20, but the size of example is 24 which means padding is being added. What I don't really understand is why and where.
Excuse me if my terminology is incorrect, but I thought that since it was 4 byte clean (i.e. size of all members % 4 == 0 ) that padding wouldn't need to be added. Is it because I am running an x86 that it needs to be 8 byte clean, or is that just the norm?
Then I don't really know where the padding is being added, I would assume around the u_long but I don't know for sure.