标准C中各种类型数值范围
c语言吧
全部回复
仅看楼主
level 9
assiss 楼主
-- number of bits for smallest object that is not a bit-field (byte) CHAR_BIT 8-- minimum value for an object of type signed char -127 // -(27 - 1) SCHAR_MIN-- maximum value for an object of type signed char +127 // 27 - 1 SCHAR_MAX-- maximum value for an object of type unsigned char 255 // 28 - 1 UCHAR_MAX-- minimum value for an object of type char see below CHAR_MIN-- maximum value for an object of type char see below CHAR_MAX-- maximum number of bytes in a multibyte character, for any supported locale MB_LEN_MAX 1-- minimum value for an object of type short int -32767 // -(215 - 1) SHRT_MIN-- maximum value for an object of type short int
+3
2767 // 215 - 1 SHRT_MAX-- maximum value for an object of type unsigned short int 65535 // 216 - 1 USHRT_MAX-- minimum value for an object of type int -32767 // -(215 - 1) INT_MIN-- maximum value for an object of type int +32767 // 215 - 1 INT_MAX-- maximum value for an object of type unsigned int 65535 // 216 - 1 UINT_MAX-- minimum value for an object of type long int -2147483647 // -(231 - 1) LONG_MIN-- maximum value for an object of type long int +2147483647 // 231 - 1 LONG_MAX-- maximum value for an object of type unsigned long int 4294967295 // 232 - 1 ULONG_MAX-- minimum value for an object of type long long int -9223372036854775807 // -(263 - 1) LLONG_MIN-- maximum value for an object of type long long int +9223372036854775807 // 263 - 1 LLONG_MAX-- maximum value for an object of type unsigned long long int
18446744073
709551615 // 264 - 1 ULLONG_MAX
2004年12月04日 16点12分 1
level 9
assiss 楼主
//-(27 - 1)表示-(2^7-1) // 27 - 1表示2^7-1以此类推。
2004年12月04日 16点12分 2
level 9
assiss 楼主
但是现在的32位编译器里,往往sizeof(int)==sizeof(long int)所以上面所说的int类型往往与long int类型范围一样。
2004年12月04日 16点12分 3
1