Defined in header <stddef.h> | ||
Defined in header <stdio.h> | ||
Defined in header <stdlib.h> | ||
Defined in header <string.h> | ||
Defined in header <time.h> | ||
Defined in header <uchar.h> | (since C11) | |
Defined in header <wchar.h> | (since C95) | |
typedef/*implementation-defined*/ size_t; | ||
size_t is the unsigned integer type of the result ofsizeof,offsetof and_Alignof(until C23)alignof(since C23), depending on thedata model.
The bit width of | (since C99) |
Contents |
size_t can store the maximum size of a theoretically possible object of any type (including array).
size_t is commonly used for array indexing and loop counting. Programs that use other types, such asunsignedint, for array indexing may fail on, e.g. 64-bit systems when the index exceedsUINT_MAX or if it relies on 32-bit modular arithmetic.
Possible implementationtypedef typeof(sizeof(0)) size_t; | (since C23) |
Possible output:
sum = 5050size = 404SIZE_MAX = 18446744073709551615
| signed integer type returned when subtracting two pointers (typedef)[edit] | |
| byte offset from the beginning of a struct type to specified member (function macro)[edit] | |
C++ documentation forsize_t | |