offsetof(3)                Linux Programmer's Manual               offsetof(3)



NAME
       offsetof - find offset in a structure

SYNOPSIS
       #include <stddef.h>

       size_t offsetof(type, member);

DESCRIPTION
       offsetof returns the offset in bytes of member within type.  The result
       is an integer constant expression with type size_t.

       member must not be a bit field.

EXAMPLE
         struct s {
           int a;
           int b;
         };

         printf("offset of a = %zu\n", offsetof(struct s, a));
         printf("offset of b = %zu\n", offsetof(struct s, b));

       The offset of a will be 0, but the offset of b will depend on the  size
       of int and on the platform's alignment rules.

CONFORMING TO
       ISO/IEC 9899



                                  2005-01-25                       offsetof(3)