Hi there,
I have a question regarding structs, I have a struct with five members, 2 bytes + 4 bytes + 2 bytes + 2 bytes + 4 bytes, so this should mean my struct is 14 bytes large, the sizes of the members are correct, if I do a sizeof(member) then I get these numbers, however sizeof(my struct) is 16 bytes large, how come?
Thanks in advance,
Bill
Update:
Ok, if I do
Code:
struct test {
unsigned short mem1;
}
Then my struct is 2 bytes large, which is fine.
If I do
Code:
struct test {
unsigned short mem1;
unsigned long mem2;
}
then my struct is 8 bytes large, even though (unsigned long) is only 4 bytes, I am confused
Somehow only the last long will get a 6 byte size, does anyone know why?
I mean I have more than one struct in my program, and the others do have correct sizes.