Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!mrccrc!dcurtis From: dcurtis@crc.ac.uk (Dr. David Curtis) Newsgroups: comp.lang.c Subject: Re: Need macro to get offset within a structure Message-ID: <493@tin.crc.ac.uk> Date: 21 Feb 91 12:43:31 GMT References: <1991Feb16.232713.6001@runx.oz.au> Reply-To: dcurtis@crc.ac.uk (Dr. David Curtis) Organization: MRC Human Genome Resource Centre Lines: 8 In article <1991Feb16.232713.6001@runx.oz.au> richardm@runx.oz.au (Richard Murnane) writes: >Hi all, >Does anybody know a decent macro to find the offset of an element >in a structure? How about: #define offset(str,el) ((char*) &((str*)NULL)->el - (char*) NULL)