5.81 Extended integer types and functions in <inttypes.h> and <stdint.h> in C99

In C90, the long data type can serve both as the largest integral type, and as a 32-bit container. C99 removes this ambiguity through the new standard library header files <inttypes.h> and <stdint.h>.

The header file <stdint.h> introduces the new types:

  • intmax_t and uintmax_t, that are maximum width signed and unsigned integer types.

  • intptr_t and unintptr_t, that are integer types capable of holding signed and unsigned object pointers.

The header file <inttypes.h> provides library functions for manipulating values of type intmax_t, including:

intmax_t imaxabs(intmax_t x); // absolute value of x
imaxdiv_t imaxdiv(intmax_t x, intmax_t y) // returns the quotient and remainder
                                          // of x / y

These header files are also available in C90 and C++.

Related concepts
5.64 New library features of C99
5.78 Additional <math.h> library functions in C99
5.79 Complex numbers in C99
5.80 Boolean type and <stdbool.h> in C99
5.82 <fenv.h> floating-point environment access in C99
5.83 <stdio.h> snprintf family of functions in C99
5.84 <tgmath.h> type-generic math macros in C99
5.85 <wchar.h> wide character I/O functions in C99
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.