How to Calculate range of data types in C++ Programming |
Calculate the ranges of values:
Maximum and minimum value which can be stored in a variables of a data type can be calculated by using the following formulas.
Let n = no of bits in data type
For signed data type:
- Lower Range = -(2^(n-1))
- Upper Range = (2^(n-1)) - 1)
For unsigned data type:
- Lower Range = 0
- Upper Range = (2^(n)) - 1
0 Comments