4 ms·
Two's complement negation of N is defined as ~N+1 (try it). ~INT_MIN == ~0x80000000 == 0x7fffffff. 0x7fffffff+1 = 0x80000000.
by ajross 15y ago
Two's complement negation of N is defined as ~N+1 (try it). ~INT_MIN == ~0x80000000 == 0x7fffffff. 0x7fffffff+1 = 0x80000000.
- eggnet 15y agoIn your last step there you are literally adding one to INT_MAX, which is an overflow. Hence the exception.