#include <stdio.h> #include <stddef.h> struct foo { char a; short b; int c; }; #define OFFSET_A offsetof(struct foo, a) #define OFFSET_B offsetof(struct foo, b) #define OFFSET_C offsetof(struct foo, c) int main () { printf ("offset A = %d\n", OFFSET_A); printf ("offset B = %d\n", OFFSET_B); printf ("offset C = %d\n", OFFSET_C); return 0; } offset A = 0 offset B = 2 offset C = 4