PRODUCT : Borland C++ NUMBER : 655 VERSION : All OS : PC DOS DATE : October 19, 1993 PAGE : 1/1 TITLE : Getting the Offset of a Member of a Structure How to get the offset of a member of a structure: #include struct mys { int member1; int member2; }; int where_b = offsetof( struct mys , member2 ); What this looks like is this: int where_b = (size_t)&(((struct mys _FAR *)0)->member2); What this does is typecast absolute address 0 to be a far pointer to the struct. Then it references member2 off of this address. Then we take the address of this location. Because 0 is cast to a far pointer, we are starting at 0000:0000 so the address of member2 will be the relative offset of a member2 within any structure. All this can be evaluated at compile time. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.