GDN:size t
This is an unsigned integer type used to represent the sizes of objects. The result of the sizeof
operator is of this type, and functions such as malloc
and memcpy
accept arguments of this type to specify object sizes. On systems using the GNU C Library, this will be unsigned int
or unsigned long int
.
size_t
is the preferred way to declare any arguments or variables that will be holding the size of an object.
Contents
Compatibility Note
Compatibility Note: Implementations of C before the advent of ISO C generally used unsigned int for representing object sizes and int for pointer subtraction results. They did not necessarily define either size_t
or ptrdiff_t
. Unix systems did define size_t
, in sys/types.h
, but the definition was usually a signed type.
Header | stddef.h |
---|---|
Supported Since | C90 |