offsetof(3) Library Functions Manual offsetof(3) offsetof - C (libc, -lc) #include size_t offsetof(type, member); offsetof() member type. , , , , . , . member (.., ), . offsetof() member type. C11, POSIX.1-2008. POSIX.1-2001, C89. Linux/i386 gcc(1) : $ ./a.out offsets: i=0; c=4; d=8 a=16 sizeof(struct s)=16 #include #include #include int main(void) { struct s { int i; char c; double d; char a[]; }; /* Output is compiler dependent */ printf("offsets: i=%zu; c=%zu; d=%zu a=%zu\n", offsetof(struct s, i), offsetof(struct s, c), offsetof(struct s, d), offsetof(struct s, a)); printf("sizeof(struct s)=%zu\n", sizeof(struct s)); exit(EXIT_SUCCESS); } () Azamat Hackimov , Konstantin Shvaykovskiy , Yuri Kozlov , Kirill Rekhov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.15 17 2025 . offsetof(3)