Previous: Floating Type Macros, Up: Data Type Measurements [Contents][Index]
You can use
offsetof to measure the location within a structure
type of a particular structure member.
Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.
This expands to an integer constant expression that is the offset of the
structure member named member in the structure type type.
offsetof (struct s, elem) is the offset, in bytes,
of the member
elem in a
This macro won’t work if member is a bit field; you get an error from the C compiler in that case.