How the size of this structure comes out to be 4 byte
问题 I do have a structure having bit-fields in it.Its comes out to be 2 bytes according to me but its coming out to be 4 .I have read some question related to this here on stackoverflow but not able to relate to my problem.This is structure i do have struct s{ char b; int c:8; }; int main() { printf("sizeof struct s = %d bytes \n",sizeof(struct s)); return 0; } if int type has to be on its memory boundary,then output should be 8 bytes but its showing 4 bytes?? 回答1: Source: http://geeksforgeeks