With the below code:
struct S {
unsigned char b1 : 3;
int i;
};
I can deduce that char b1 is of 1 byte and using 3 bits of that and int is 4 bytes but when I try to print out the size of S, I get it 8 bytes instead of 5 bytes(1 for char+4 for int) as I expected and this is something I am not understanding by obvious. Can something explain why size of S is 8 bytes?