The <stddef.h> Header File

ANSI definitions of default macros and types

Functions

offsetof
Returns the offset of a member in a structure.

Constants

NULL
A null-pointer value.

Predefined Types

ptrdiff_t
A type to define the result of subtracting two pointers. [Explanation] ptrdiff_t is a type proposed by ANSI C for defining the result of subtracting two pointers (e.g. the first address after the end of an array minus the beginning of the array).
size_t
A type to define sizes of strings and memory blocks.

offsetof

#define offsetof(type,member) ((unsigned long) &(((type*)0)->member))

Returns the offset of a member in a structure.

offsetof is a macro which returns the offset of a member in a structure type. The type can either be defined through typedef, or preceded by struct, as usual.

Deprecated alias: OFFSETOF

See also: sizeof, typeof


ptrdiff_t

typedef long ptrdiff_t;

A type to define the result of subtracting two pointers.

ptrdiff_t is a type proposed by ANSI C for defining the result of subtracting two pointers (e.g. the first address after the end of an array minus the beginning of the array).


size_t

typedef unsigned long size_t;

A type to define sizes of strings and memory blocks.

size_t is a type proposed by ANSI C for defining sizes of strings and memory blocks.


Return to the main index