Limit of Integer variable. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Limit of Integer variable.

what is the limit of integer variable in C++ ?

7th Nov 2016, 6:22 PM
Amit Kumar
2 Answers
+ 3
int variable takes 4 bytes 1byte = 8 bits 4 times 8 is 32 each bit can be either 1 or 0 so 2^32 is all the possible states an int can take take into consideration the negative numbers and you will be left with (2^31)-1 which is 2,147,483,648 TL;DR: roughly 2.15 billion
7th Nov 2016, 7:16 PM
Burey
Burey - avatar
0
for signed integer : -2147483648 to 2147483647
7th Nov 2016, 7:13 PM
Amit Gupta
Amit Gupta - avatar