The C99 standard indicates the contents of the <limits.h> header as follows:
Their values ββdetermined by the implementation must be equal or greater in magnitude (absolute value) to those shown, with the same sign.
- minimum value for an object of type int
INT_MIN -32767 // - (2 15 - 1) - maximum value for an object of type int
INT_MAX +32767 // 2 15 - 1 - maximum value for an object of type unsigned int
UINT_MAX 65535 // 2 16 - 1
There are no size requirements in int .
However, the <stdint.h> header offers additional integer types of exact width int8_t , int16_t , int32_t , int64_t and their unsigned counterpart:
The name typedef intN_t denotes an integer type with a width of N, no fill bits and a double set representation. Thus, int8_t denotes an integer type with a width of exactly 8 bits .
icecrime
source share