#include <stdint.h>
The <stdint.h> header declares sets of integer types having specified widths, and defines corresponding sets of macros. It also defines macros that specify limits of integer types corresponding to types defined in other standard headers.
The ``width'' of an integer type is the number of bits used to store its value in a pure binary system; the actual type can use more bits than that (for example, a 28bit type could be stored in 32 bits of actual storage). An Nbit signed type has values in the range 2^N1 or 12^N1 to 2^N11, while an Nbit unsigned type has values in the range 0 to 2^N1.
Types are defined in the following categories:
Some of these types may denote the same type.
Corresponding macros specify limits of the declared types and construct suitable constants.
For each type described herein that the implementation provides, the <stdint.h> header declares that typedef name and defines the associated macros. Conversely, for each type described herein that the implementation does not provide, the <stdint.h> header does not declare that typedef name, nor does it define the associated macros. An implementation provides those types described as required, but need not provide any of the others (described as optional).
When typedef names differing only in the absence or presence of the initial u are defined, they denote corresponding signed and unsigned types as described in the ISO/IEC 9899: 1999 standard, Section 6.2.5; an implementation providing one of these corresponding types must also provide the other.
In the following descriptions, the symbol N represents an unsigned decimal integer with no leading zeros (for example, 8 or 24, but not 04 or 048).
Exactwidth integer types
The typedef name uintN_t designates an unsigned integer type with width N. Thus, uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
The following types are required:
int8_t int16_t int32_t uint8_t uint16_t uint32_t
If an implementation provides integer types with width 64 that meet these requirements, then the following types are required:
int64_t uint64_t
In particular, this is the case if any of the following are true:
Minimumwidth integer types
The typedef name uint_leastN_t designates an unsigned integer type with a width of at least N, such that no unsigned integer type with lesser size has at least the specified width. Thus, uint_ least16_t denotes an unsigned integer type with a width of at least 16 bits.
The following types are required:
int_least8_t int_least16_t int_least32_t int_least64_t uint_least8_t uint_least16_t uint_least32_t uint_least64_t
All other types of this form are optional.
Fastest minimumwidth integer types
The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear grounds for choosing one type over another, it will simply pick some integer type satisfying the signedness and width requirements.
The typedef name int_fastN_t designates the fastest signed integer type with a width of at least N. The typedef name uint_fastN_ t designates the fastest unsigned integer type with a width of at least N.
The following types are required:
int_fast8_t int_fast16_t int_fast32_t int_fast64_t uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
All other types of this form are optional.
Integer types capable of holding object pointers
intptr_t
uintptr_t
On standardconforming systems, the intptr_t and uintptr_t types are required; otherwise, they are optional.
Greatestwidth integer types
intmax_t
uintmax_t
These types are required.
Applications can test for optional types by using the corresponding limit macro from Limits of SpecifiedWidth Integer Types.
The following macros specify the minimum and maximum limits of the types declared in the <stdint.h> header. Each macro name corresponds to a similar type name in Integer Types.
Each instance of any defined macro is replaced by a constant expression suitable for use in #if preprocessing directives. This expression has the same type as would an expression that is an object of the corresponding type converted according to the integer promotions. Its implementationdefined value is equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign, except where stated to be exactly the given value.
Limits of exactwidth integer types
{INTN_MIN}
{INTN_MAX}
{UINTN_MAX}
Limits of minimumwidth integer types
{INT_LEASTN_MIN}
{INT_LEASTN_MAX}
{UINT_LEASTN_MAX}
Limits of fastest minimumwidth integer types
{INT_FASTN_MIN}
{INT_FASTN_MAX}
{UINT_FASTN_MAX}
Limits of integer types capable of holding object pointers
{INTPTR_MIN}
{INTPTR_MAX}
{UINTPTR_MAX}
Limits of greatestwidth integer types
{INTMAX_MIN}
{INTMAX_MIN}
{UINTMAX_MIN}
The following macros specify the minimum and maximum limits of integer types corresponding to types defined in other standard headers.
Each instance of these macros is replaced by a constant expression suitable for use in #if preprocessing directives. This expression has the same type as would an expression that is an object of the corresponding type converted according to the integer promotions. Its implementationdefined value is equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign.
Limits of ptrdiff_t:
{PTRDIFF_MIN}
{PTRDIFF_MAX}
Limits of sig_atomic_t:
{SIG_ATOMIC_MIN}
{SIG_ATOMIC_MAX}
Limits of size_t:
{SIZE_MAX}
Limits of wchar_t:
{WCHAR_MIN}
{WCHAR_MAX}
Limits of wint_t:
{WINT_MIN}
{WINT_MAX}
If sig_atomic_t (see the <signal.h> header) is defined as a signed integer type, the value of {SIG_ATOMIC_MIN} is no greater than 127 and the value of {SIG_ATOMIC_MAX} is no less than 127. Otherwise, sig_atomic_t is defined as an unsigned integer type, the value of {SIG_ATOMIC_MIN} is 0, and the value of {SIG_ATOMIC_MAX} is no less than 255.
If wchar_t (see the <stddef.h> header) is defined as a signed integer type, the value of {WCHAR_MIN} is no greater than 127 and the value of {WCHAR_MAX} is no less than 127. Otherwise, wchar_t is defined as an unsigned integer type, and the value of {WCHAR_MIN} is 0 and the value of {WCHAR_MAX} is no less than 255.
If wint_t (see the <wchar.h> header) is defined as a signed integer type, the value of {WINT_MIN} is no greater than 32767 and the value of {WINT_MAX} is no less than 32767. Otherwise, wint_t is defined as an unsigned integer type, and the value of {WINT_MIN} is 0 and the value of {WINT_MAX} is no less than 65535.
The following macros expand to integer constant expressions suitable for initializing objects that have integer types corresponding to types defined in the <stdint.h> header. Each macro name corresponds to a similar type name listed under minimumwidth integer types and greatestwidth integer types.
Each invocation of one of these macros expands to an integer constant expression suitable for use in #if preprocessing directives. The type of the expression has the same type as would an expression that is an object of the corresponding type converted according to the integer promotions. The value of the expression is that of the argument. The argument in any instance of these macros is a decimal, octal, or hexadecimal constant with a value that does not exceed the limits for the corresponding type.
Macros for minimumwidth integer constant expressions
Macros for greatestwidth integer constant expressions
INTMAX_C(value)
The following macro expands to an integer constant expression having the value specified by its argument and the type uintmax_t:
UINTMAX_C(value)
See attributes(5) for descriptions of the following attributes:

inttypes.h(3HEAD), signal.h(3HEAD), stddef.h(3HEAD), wchar.h(3HEAD), attributes(5), standards(5)