0
Why the value is not same?
#include <iostream> using namespace std; int main() { int x=3456789011; cout <<x; return 0; }
3 odpowiedzi
+ 5
In C, the integer (for 32 bit machine) is 32 bits, and it ranges from -32768 to +32767. In Java, the integer is also 32 bits, but ranges from -2,147,483,648 to +2,147,483,647.
the number you are giving is out of range it is deducting max range and showing you remaining number
+ 4
@Melih
Out of curiosity, what makes C's int such a small range when it uses the same amount of memory compared to Java?
Does an integer only occupy 16 bits unless instructed to occupy 32?
+ 1
because the range of the integer type is from -2147483648~2147483647.
you can use sizeof () to see why is that range