I can read that int range (signed) from [-32767, +32767] but I can say for example
int a=70000; int b=71000; int c=a+b; printf("%i", c); return 0;
And the result is 141000 (correct). Shouldn't the debugger tell me "this operation is out of range" or something like that?
I believe this should be with me, ignoring the basics of C programming, but not one of the books I'm reading now says anything about this "problem."
EDIT: 2147483647 seems to be an upper limit, thanks. If the sum exceeds this number, the result is negative, expected, but if it is a subtraction, for example: 2147483649-2147483647 = 2 , the result will still be good. I mean, why is the value 2147483649 true for this purpose (or at least it seems to me)?
source share