Maximum and minimum values of various types in C/C++
Need to import #include<limits.h>
and #include<float.h>
two libraries, the following is a description of each constant.
constant | Description | value |
---|---|---|
CHAR_MIN, CHAR_MAX | Character max/min | -128 127 |
SHRT_MIN, SHRT_MAX | Short integer max/min | -32768, 32767 |
INT_MIN, INT_MAX | Integer max/min | -2147483648, 2147483647 |
LONG_MIN, LONG_MAX | Long integer maximum/minimum value | -2147483648, 2147483647 |
LONG_LONG_MIN, LONG_LONG_MAX | Ultra long integer maximum/minimum value | -9223372036854775808, 9223372036854775807 |
FLT_MIN, FLT_MAX | Single precision floating point maximum/minimum value | 1.17549e-038, 3.40282e+038 |
DBL_MIN, DBL_MAX | Double precision floating point maximum/minimum value | 2.22507e-308, 1.79769e + 308 |
These can be used in some algorithm tests~