offsetof

Returns the offset of an element within a structure

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Platform:NLM
Service:Data Manipulation

Syntax

  #include <stddef.h>  
   
  size_t offsetof  (  
     composite,   
     name);
  

Parameters

composite
(IN) Specifies the structure or union for which to return an element offset.
name
(IN) Specifies the element in the structure for which to return the offset.

Return Values

Returns the offset of the element specified by the name parameter.

Remarks

offsetof provides a portable method to return the offset of the element specified by the name parameter within the structure or union specified by the composite parameter.

offsetof cannot be used to initialize data. It can only be used with executable statements.