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).
Please explain the behavior of above statement.
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).
Please explain the behavior of above statement.