Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!ncar!boulder!pikes!aspen.craycos.com!pmk From: pmk@craycos.com (Peter Klausler) Newsgroups: comp.lang.c Subject: Re: How to get a byte offset Message-ID: <1990May28.163515.7070@craycos.com> Date: 28 May 90 16:35:15 GMT Organization: Cray Computer Corporation Lines: 10 >Is there an easy way to get the byte offset of a field in a structure without >counting it manually ? In ANS C, #include and use the offsetof macro. If you don't have access to a standard compiler, try this common trick: #define offsetof(type,member) ((char *) &((type *) 0)->member - (char *) 0) -Peter Klausler, a compiler guy at Cray Computer Corp. in Colorado Springs