Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpfcdc!jafo From: jafo@hpfcdc.HP.COM (Sean Reifschneider) Newsgroups: comp.sys.amiga.tech Subject: Re: Determining structure field offsets Message-ID: <11640016@hpfcdc.HP.COM> Date: 19 Apr 89 22:09:45 GMT References: <9270@watcgl.waterloo.edu> Organization: HP Ft. Collins, Co. Lines: 19 >'sizeof' operator. Wouldn't it be correct to use something like: > > offset_to_second_field = sizeof(structure.first_field) Only if you wanted the second element of the structure. If there are an unknown number of elements (0..n) in the structure: offset_to_N_field = pointer_to_N - pointer_to_structure or: struct { int foo, bar; } *baz; long offset; offset = ((long) &baz->bar) - ((long) baz); works. Sean