Integer Limits

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Integer Limits.

Microsoft Specific**

The limits for integer types are listed in the following table. These limits are also defined in the standard header file LIMITS.H.

Limits on Integer Constants

ConstantMeaningValue
CHAR_BITNumber of bits in the smallest variable that is not a bit field.8
SCHAR_MINMinimum value for a variable of type signed char.–128
SCHAR_MAXMaximum value for a variable of type signed char.127
UCHAR_MAXMaximum value for a variable of type unsigned char.255 (0xff)
CHAR_MINMinimum value for a variable of type char.–128; 0 if /J option used
CHAR_MAXMaximum value for a variable of type char.127; 255 if /J option used
MB_LEN_MAXMaximum number of bytes in a multicharacter constant.5
SHRT_MINMinimum value for a variable of type short.–32768
SHRT_MAXMaximum value for a variable of type short.32767
USHRT_MAXMaximum value for a variable of type unsigned short.65535 (0xffff)
INT_MINMinimum value for a variable of type int.–2147483648
INT_MAXMaximum value for a variable of type int.2147483647
UINT_MAXMaximum value for a variable of type unsigned int.4294967295 (0xffffffff)
LONG_MINMinimum value for a variable of type long.–2147483648
LONG_MAXMaximum value for a variable of type long.2147483647
ULONG_MAXMaximum value for a variable of type unsigned long.4294967295 (0xffffffff)
_I64_MINMinimum value for a variable of type __int64-9223372036854775808
_I64_MAXMaximum value for a variable of type __int649223372036854775807
_UI64_MAXMaximum value for a variable of type unsigned __int6418446744073709551615 (0xffffffffffffffff)

If a value exceeds the largest integer representation, the Microsoft compiler generates an error.

Floating Limits

Show: