您的位置:首页 > 编程语言 > C语言/C++

关于C++中头文件<climits>

2014-09-02 13:23 567 查看
头文件<climits> 里面定义了各种datatype 的极限值。 常常我们需要使用这个极限值对数组, 变量等进行初始化。 该头文件下定义的宏如下:



Macro constants

nameexpressesvalue*
CHAR_BITNumber of bits in a
char
object (byte)
8
or greater*
SCHAR_MINMinimum value for an object of type
signed char
-127
(
-27+1
) or less*
SCHAR_MAXMaximum value for an object of type
signed char
127
(
27-1
) or greater*
UCHAR_MAXMaximum value for an object of type
unsigned char
255
(
28-1
) or greater*
CHAR_MINMinimum value for an object of type
char
either SCHAR_MIN or
0
CHAR_MAXMaximum value for an object of type
char
either SCHAR_MAX or UCHAR_MAX
MB_LEN_MAXMaximum number of bytes in a multibyte character, for any locale
1
or greater*
SHRT_MINMinimum value for an object of type
short int
-32767
(
-215+1
) or less*
SHRT_MAXMaximum value for an object of type
short int
32767
(
215-1
) or greater*
USHRT_MAXMaximum value for an object of type
unsigned short int
65535
(
216-1
) or greater*
INT_MINMinimum value for an object of type
int
-32767
(
-215+1
) or less*
INT_MAXMaximum value for an object of type
int
32767
(
215-1
) or greater*
UINT_MAXMaximum value for an object of type
unsigned int
65535
(
216-1
) or greater*
LONG_MINMinimum value for an object of type
long int
-2147483647
(
-231+1
) or less*
LONG_MAXMaximum value for an object of type
long int
2147483647
(
231-1
) or greater*
ULONG_MAXMaximum value for an object of type
unsigned long int
4294967295
(
232-1
) or greater*
LLONG_MINMinimum value for an object of type
long long int
-9223372036854775807
(
-263+1
) or less*
LLONG_MAXMaximum value for an object of type
long long int
9223372036854775807
(
263-1
) or greater*
ULLONG_MAXMaximum value for an object of type
unsigned long long int
18446744073709551615
(
264-1
) or greater*
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐