Hi,

The below macro is defined in stddef.h standard header file.
#define offsetof(s,m) (size_t)&(((s *)0)->m)

This gives offset of member data 'm' in structure 's'

Ex:
struct example {
int a;
int b;
};

printf("%d", offsetof(example, b) ) displays 4 (In win32).

Can any one explain how offsetof macro is working?

Thanks.