First element offset
问题 Is it a WARRANTY, that offset of first element of structure is 0? To be more accurate, lets consider struct foo { int a; double b; }; struct foo *ptr=malloc(sizeof(struct foo)); int *int_ptr = &ptr->a; free(int_ptr) Is it garantied, that it is valid always, under any os or any other factors? 回答1: Yes it is guaranteed. Will get you a standard quote, let me lookup. C99 Standard: §6.7.2.1 Para 12 Within a structure object, the non-bit-field members and the units in which bit-fields reside have