, inttypes

Synopsis

Description

structure type that is the type of the value returned by the imaxdiv() function.

The following macros are defined. Each expands to a character string literal
containing a conversion specifier, possibly modified by a length modifier, suitable for
use within the format argument of a formatted input/output function when converting
the corresponding integer type. These macros have the general form of PRI (character
string literals for the fprintf() and fwprintf() family of functions) or SCN
(character string literals for the fscanf() and fwscanf() family of functions), followed by
the conversion specifier, followed by a name corresponding to a similar type
name in <stdint.h>. In these names, N represents the width of the
type as described in <stdint.h>. For example, PRIdFAST32 can be used in a
format string to print the value of an integer of type int_fast32_t.

For each type that the implementation provides in <stdint.h>, the corresponding fprintf()
and fwprintf() macros must be defined. The corresponding fscanf() and fwscanf()
macros must be defined as well, unless the implementation does not have a
suitable modifier for the type.

Usage

The purpose of <inttypes.h> is to provide a set of integer types
whose definitions are consistent across machines and independent of operating systems and
other implementation idiosyncrasies. It defines, with a typedef, integer types of various sizes.
Implementations are free to typedef them as ISO C standard integer types
or extensions that they support. Consistent use of this header greatly increases
the portability of applications across platforms.

Examples

Example 1 Use of Macro

The following code uses one of the macros available through <inttypes.h>.