Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!rutgers!umn-d-ub!cs.umn.edu!swie From: swie@cs.umn.edu (S. T. Tan) Newsgroups: comp.lang.c Subject: How to get a byte offset Message-ID: <1990May28.034643.6962@cs.umn.edu> Date: 28 May 90 03:46:43 GMT Sender: S. T. Tan Distribution: usa Organization: U of M, Mpls. Lines: 19 Is there an easy way to get the byte offset of a field in a structure without counting it manually ? The reason I don't want to count the offset manually is, the size of the "int"-type is machine dependent (may be 2 bytes or 4 bytes). example: struct { int a; char b[3]; int c[10]; char d; } my_struct_type; What would be the offset of "d" ? Please e-mail the answer to me directly since it seems to me that the answer is trivial. Thanks in advance swie@umn-cs.cs.umn.edu