inttypes(5) inttypes(5)
NAME [Toc] [Back]
inttypes - basic integer data types
SYNOPSIS [Toc] [Back]
#include <inttypes.h>
DESCRIPTION [Toc] [Back]
This header file defines integer data types of various sizes. By
using the data types defined in this header file, developers can be
assured that the data types will have the same properties and behavior
on different systems.
Since not all implementations are required to support all of the
integer sizes defined in this manual page, the proper way to see if a
particular size of an integer is supported on the current
implementation is to test the symbol that defines its maximum value.
For example, if #ifdef UINT64_MAX tests false, then that
implementation does not support 64-bit unsigned signed integers.
This header file defines the following integer data types for 8, 16,
32, and 64 bits.
intmax_t largest signed integer data type supported by implementation
int8_t 8-bit signed integer
int16_t 16-bit signed integer
int32_t 32-bit signed integer
int64_t 64-bit signed integer
uintmax_t largest unsigned integer data type supported by implementation
uint8_t 8-bit unsigned integer
uint16_t 16-bit unsigned integer
uint32_t 32-bit unsigned integer
uint64_t 64-bit unsigned integer
The following two data types are signed and unsigned integer data
types that are large enough to hold a pointer. A pointer can be moved
to or from these data types without corruption.
intptr_t signed integer type that is large enough to hold a pointer
uintptr_t unsigned integer type that is large enough to hold a pointer
This header file defines the following integer data types for
determining the most efficient data types to use for integer values on
a particular implementation.
intfast_t most efficient signed integer data type supported by implementation
int_fast8_t most efficient signed integer of at least 8 bits
int_fast16_t most efficient signed integer of at least 16 bits
int_fast32_t most efficient signed integer of at least 32 bits
int_fast64_t most efficient signed integer of at least 64 bits
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
inttypes(5) inttypes(5)
uintfast_t most efficient unsigned integer data type supported by implementation
uint_fast8_t most efficient unsigned integer of at least 8 bits
uint_fast16_t most efficient unsigned integer of at least 16 bits
uint_fast32_t most efficient unsigned integer of at least 32 bits
uint_fast64_t most efficient unsigned integer of at least 64 bits
This header file defines the following integer data types for
compatibility with systems that do not fit the 16-bit or 32-bit word
size model. These data types define the signed and unsigned integers
of at least 8, 16, 32, and 64 bits.
int_least8_t smallest signed integer of at least 8 bits
int_least16_t smallest signed integer of at least 16 bits
int_least32_t smallest signed integer of at least 32 bits
int_least64_t smallest signed integer of at least 64 bits
uint_least8_t smallest unsigned integer of at least 8 bits
uint_least16_t smallest unsigned integer of at least 16 bits
uint_least32_t smallest unsigned integer of at least 32 bits
uint_least64_t smallest unsigned integer of at least 64 bits
The following macros define the minimum and maximum values that can be
stored in the above data types.
INTMAX_MIN minimum value that can be stored in the largest integer data type
INTMAX_MAX maximum value that can be stored in the largest signed integer data type
UINTMAX_MAX maximum value that can be stored in the largest unsigned integer data type
INTFAST_MIN minimum value that can be stored in the most efficient integer data type
INTFAST_MAX maximum value that can be stored in the most efficient signed integer data type
UINTFAST_MAX maximum value that can be stored in the most efficient unsigned integer data type
INT8_MIN minimum value that can be stored in an int8_t data type
INT16_MIN minimum value that can be stored in an int16_t data type
INT32_MIN minimum value that can be stored in an int32_t data type
INT64_MIN minimum value that can be stored in an int64_t data type
INT8_MAX maximum value that can be stored in an int8_t data type
INT16_MAX maximum value that can be stored in an int16_t data type
INT32_MAX maximum value that can be stored in an int32_t data type
INT64_MAX maximum value that can be stored in an int64_t data type
UINT8_MAX maximum value that can be stored in an uint8_t data type
UINT16_MAX maximum value that can be stored in an uint16_t data type
UINT32_MAX maximum value that can be stored in an uint32_t data type
UINT64_MAX maximum value that can be stored in an uint64_t data type
INT_FAST8_MIN minimum value that can be stored in an int_fast8_t data type
INT_FAST16_MIN minimum value that can be stored in an int_fast16_t data type
INT_FAST32_MIN minimum value that can be stored in an int_fast32_t data type
INT_FAST64_MIN minimum value that can be stored in an int_fast64_t data type
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
inttypes(5) inttypes(5)
INT_FAST8_MAX maximum value that can be stored in an int_fast8_t data type
INT_FAST16_MAX maximum value that can be stored in an int_fast16_t data type
INT_FAST32_MAX maximum value that can be stored in an int_fast32_t data type
INT_FAST64_MAX maximum value that can be stored in an int_fast64_t data type
INT_LEAST8_MIN minimum value that can be stored in an int_least8_t data type
INT_LEAST16_MIN minimum value that can be stored in an int_least16_t data type
INT_LEAST32_MIN minimum value that can be stored in an int_least_32_t data type
INT_LEAST64_MIN minimum value that can be stored in an int_least_64_t data type
INT_LEAST8_MAX maximum value that can be stored in an int_least8_t data type
INT_LEAST16_MAX maximum value that can be stored in an int_least16_t data type
INT_LEAST32_MAX maximum value that can be stored in an int_least_32_t data type
INT_LEAST64_MAX maximum value that can be stored in an int_least_64_t data type
The following macros can be used as formatting options with the
printf() family of functions (see printf(3S)). These macros are used
to select the correct formatting option for the integer data types
defined earlier in this manual page.
PRId8 d print formatting option for int8_t
PRId16 d print formatting option for int16_t
PRId32 d print formatting option for int32_t
PRId64 d print formatting option for int64_t
PRIdMAX d print formatting option for intmax_t
PRIdFAST8 d print formatting option for int_fast8_t
PRIdFAST16 d print formatting option for int_fast16_t
PRIdFAST32 d print formatting option for int_fast32_t
PRIdFAST64 d print formatting option for int_fast64_t
PRIdFAST d print formatting option for intfast_t
PRIdLEAST8 d print formatting option for int_least8_t
PRIdLEAST16 d print formatting option for int_least16_t
PRIdLEAST32 d print formatting option for int_least32_t
PRIdLEAST64 d print formatting option for int_least64_t
PRIi8 i print formatting option for int8_t
PRIi16 i print formatting option for int16_t
PRIi32 i print formatting option for int32_t
PRIi64 i print formatting option for int64_t
PRIiFAST8 i print formatting option for int_fast8_t
PRIiFAST16 i print formatting option for int_fast16_t
PRIiFAST32 i print formatting option for int_fast32_t
PRIiFAST64 i print formatting option for int_fast64_t
PRIiLEAST8 i print formatting option for int_least8_t
PRIiLEAST16 i print formatting option for int_least16_t
PRIiLEAST32 i print formatting option for int_least32_t
PRIiLEAST64 i print formatting option for int_least64_t
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
inttypes(5) inttypes(5)
PRIu8 u print formatting option for uint8_t
PRIu16 u print formatting option for uint16_t
PRIu32 u print formatting option for uint32_t
PRIu64 u print formatting option for uint64_t
PRIuMAX u print formatting option for uintmax_t
PRIuFAST8 u print formatting option for uint_fast8_t
PRIuFAST16 u print formatting option for uint_fast16_t
PRIuFAST32 u print formatting option for uint_fast32_t
PRIuFAST64 u print formatting option for uint_fast64_t
PRIuFAST u print formatting option for uintfast_t
PRIuLEAST8 u print formatting option for uint_least8_t
PRIuLEAST16 u print formatting option for uint_least16_t
PRIuLEAST32 u print formatting option for uint_least32_t
PRIuLEAST64 u print formatting option for uint_least64_t
PRIo8 o print formatting option for int8_t
PRIo16 o print formatting option for int16_t
PRIo32 o print formatting option for int32_t
PRIo64 o print formatting option for int64_t
PRIoMAX o print formatting option for intmax_t
PRIoFAST8 o print formatting option for int_fast8_t
PRIoFAST16 o print formatting option for int_fast16_t
PRIoFAST32 o print formatting option for int_fast32_t
PRIoFAST64 o print formatting option for int_fast64_t
PRIoFAST o print formatting option for intfast_t
PRIoLEAST8 o print formatting option for int_least8_t
PRIoLEAST16 o print formatting option for int_least16_t
PRIoLEAST32 o print formatting option for int_least32_t
PRIoLEAST64 o print formatting option for int_least64_t
PRIx8 x print formatting option for int8_t
PRIx16 x print formatting option for int16_t
PRIx32 x print formatting option for int32_t
PRIx64 x print formatting option for int64_t
PRIxMAX x print formatting option for intmax_t
PRIxFAST8 x print formatting option for int_fast8_t
PRIxFAST16 x print formatting option for int_fast16_t
PRIxFAST32 x print formatting option for int_fast32_t
PRIxFAST64 x print formatting option for int_fast64_t
PRIoFAST x print formatting option for intfast_t
PRIxLEAST8 x print formatting option for int_least8_t
PRIxLEAST16 x print formatting option for int_least16_t
PRIxLEAST32 x print formatting option for int_least32_t
PRIxLEAST64 x print formatting option for int_least64_t
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
inttypes(5) inttypes(5)
PRIX8 X print formatting option for int8_t
PRIX16 X print formatting option for int16_t
PRIX32 X print formatting option for int32_t
PRIX64 X print formatting option for int64_t
PRIXFAST8 X print formatting option for int_fast8_t
PRIXFAST16 X print formatting option for int_fast16_t
PRIXFAST32 X print formatting option for int_fast32_t
PRIXFAST64 X print formatting option for int_fast64_t
PRIXLEAST8 X print formatting option for int_least8_t
PRIXLEAST16 X print formatting option for int_least16_t
PRIXLEAST32 X print formatting option for int_least32_t
PRIXLEAST64 X print formatting option for int_least64_t
The following macros can be used as formatting options with the
scanf() family of functions (see scanf(3S)). These macros are used to
select the correct formatting option for the integer data types
defined earlier in this manual page.
SCNd16 d scan formatting option for int16_t
SCNd32 d scan formatting option for int32_t
SCNd64 d scan formatting option for int64_t
SCNdMAX d scan formatting option for intmax_t
SCNi16 i scan formatting option for int16_t
SCNi32 i scan formatting option for int32_t
SCNi64 i scan formatting option for int64_t
SCNiMAX i scan formatting option for intmax_t
SCNu16 u scan formatting option for uint16_t
SCNu32 u scan formatting option for uint32_t
SCNu64 u scan formatting option for uint64_t
SCNo16 o scan formatting option for int16_t
SCNo32 o scan formatting option for int32_t
SCNo64 o scan formatting option for int64_t
SCNoMAX o scan formatting option for intmax_t
SCNx16 x scan formatting option for int16_t
SCNx32 x scan formatting option for int32_t
SCNx64 x scan formatting option for int64_t
SCNxMAX x scan formatting option for intmax_t
SCNdFAST d scan formatting option for intfast_t
SCNiFAST i scan formatting option for intfast_t
SCNoFAST o scan formatting option for intfast_t
SCNxFAST x scan formatting option for intfast_t
NOTES [Toc] [Back]
The formatting options for the printf() family of functions all begin
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003
inttypes(5) inttypes(5)
with PRI, whereas the formatting options for the scanf() family of
functions all begin with SCN. These formatting strings may not be
interchangeable.
EXAMPLES [Toc] [Back]
The following example shows how to use one of the print formatting
options with the printf() function.
uint64_t u;
...
printf("u = %016" PRIx64 "\n", u);
AUTHOR [Toc] [Back]
inttypes.h was developed by HP.
FILES [Toc] [Back]
/usr/include/inttypes.h
SEE ALSO [Toc] [Back]
printf(3S), scanf(3S).
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: August 2003 [ Back ] |