| |||
| Home > Compiler Coding Practices > 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++.