RAD Studio
ContentsIndex
PreviousUpNext
offsetof

Header File 

stddef.h 

Category 

Memory Routines 

Prototype 

size_t offsetof(struct_type, struct_member); 

Description 

Gets the byte offset to a structure member. 

offsetof is available only as a macro. The argument struct_type is a struct type. struct_member is any element of the struct that can be accessed through the member selection operators or pointers. 

If struct_member is a bit field, the result is undefined. 

See also sizeof for more information on memory allocation and alignment of structures. 

Return Value 

offsetof returns the number of bytes from the start of the structure to the start of the named structure member. 

Portability  

POSIX 
Win32 
ANSI C 
ANSI C++ 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!