The limits.h header file defines constants that specify the ranges of the integral types. Values are assigned to constants for the minimum and maximum possible values. The following declarations are typically found in the header file limits.h. The declarations have been simplified. Code for compiler specific language extensions is not included.
The char type can be either signed or unsigned, depending on compiler switches. Conditional preprocessor code determines which option has been specified or implied, and assigns values to the range constants accordingly.
#define CHAR_BIT 8
#define MB_LEN_MAX 2
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
#if ('\x80' < 0)
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#else
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#endif
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX-1)
#define UINT_MAX 0xffffffff
#define SHRT_MAX 32767
#define SHRT_MIN (-SHRT_MAX-1)
#define USHRT_MAX 0xffff
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX-1)
#define ULONG_MAX 0xffffffffUL
#define CHAR_BIT 8 #if (((int)((char)0x80)) < 0) #define CHAR_MAX 127 #define CHAR_MIN (-128) #else #define CHAR_MAX 255 #define CHAR_MIN 0 #endif #define SCHAR_MAX 127 #define SCHAR_MIN (-128) #define UCHAR_MAX 255 #define SHRT_MAX 0x7FFF #define SHRT_MIN ((int)0x8000) #define USHRT_MAX 0xFFFFU #define INT_MAX 0x7FFF #define INT_MIN ((int)0x8000) #define UINT_MAX 0xFFFFU #define LONG_MAX 0x7FFFFFFFL #define LONG_MIN ((long)0x80000000L) #define ULONG_MAX 0xFFFFFFFFUL
| ⇒ float.h | Floating point ranges |