why does long long 2147483647 + 1 = -2147483648? [duplicate]
2147483647 + 1 is evaluated as the sum of two ints and therefore overflows. 2147483648 is too big to fit in an int and is therefore assumed by the compiler to be a long (or a long long in MSVC). It therefore does not overflow. To perform the summation as a long long use the … Read more