#include #include #pragma pack(8) struct Test { short field1; char field2[17]; }; #pragma pack() int main(int argc, char** argv) { printf("Test.size = %d\n", sizeof(struct Test)); printf("Test member offsets and sizes:\n"); printf("\tfield1=%d %d \n\tfield2=%d %d\n", offsetof(struct Test, field1), sizeof(((struct Test*)0)->field1), offsetof(struct Test, field2), sizeof(((struct Test*)0)->field2)); return 0; };