How do bit fields and their alignments work in C programming?
问题 I need your help at understanding how bit fields work in C programming. I have declared this struct: struct message { unsigned char first_char : 6; unsigned char second_char : 6; unsigned char third_char : 6; unsigned char fourth_char : 6; unsigned char fifth_char : 6; unsigned char sixth_char : 6; unsigned char seventh_char : 6; unsigned char eigth_char : 6; }__packed message; I saved the size of the struct into an integer using sizeof(message). I thought the value of the size will be 6