In c++, is there any relation between range of data type and its size in bytes. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In c++, is there any relation between range of data type and its size in bytes.

bytes only tel.us the combinations of 0 and 1

22nd Aug 2018, 5:30 PM
Sandy
1 Answer
+ 1
Yes there is, but only for integer types (short, int, long, and long long) along with their unsigned variants. For signed integer, number of bits to calculate for measuring range is reduced by one. 16 bit Signed: -2^15 up to (2^15)-1 Unsigned: 0 up to (2^16)-1 32 bit Signed: -2^31 up to (2^31)-1 Unsigned: 0 up to (2^32)-1 64 bit Signed: -2^63 up to (2^63)-1 Unsigned: 0 up to (2^64)-1 Hth, cmiiw
22nd Aug 2018, 6:00 PM
Ipang