I'm using MSVC 2019.
So, I just searched here.
They says that long long
is 8 byte, and range of values is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
So, what I thought is, that this would work:
long long a = 2147483648 + 2147483648;
printf("%lld", a);
I thought it would print 4294967296
, which equals to 2147483648 + 2147483648
.
But it prints 0
to me.....
So, this time I tried little differently:
long long a = 2147483648;
printf("%lld", a + a);
and it prints 4294967296
!!!
So here are two questions.
FIRST: What is difference between those codes?
SECOND: Why the first code gives me wrong number(0)?
Thanks in advance :)