What is range of int? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is range of int?

from - to +.

30th Aug 2017, 8:49 AM
Nakul Solankar
Nakul Solankar - avatar
4 Answers
+ 8
Extending @ThreeG's answer, those values also correspond to ±(2^31 - 1).
30th Aug 2017, 10:22 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
from -2147483648 to 2147483647
30th Aug 2017, 9:01 AM
ThreeG
ThreeG - avatar
+ 2
It depends on what machine you are on! You are guaranteed a range from -32767 to 32767 from the C++ standard, but on most modern computers you'll get what ThreeG posted. you can #include <limits> std::cout << std::numeric_limits<int>::min(); std::cout << std::numeric_limits<int>::max(); to check.
30th Aug 2017, 9:29 AM
Schindlabua
Schindlabua - avatar
0
thanks
30th Aug 2017, 10:41 AM
Nakul Solankar
Nakul Solankar - avatar