#include <stdio.h>
int main(){
int x = -10;
printf("\%d\n",~x+1);
return 0;
}
~x + 1 = > 2's
complement of X
.. I couldn't understand this
x = 1111 1111 1111 1010
one's complement of x [~x] - 0000 0000 0000 0101
Adding 1
to it [~x + 1] - 0000 0000 0000 0110
which is not 10
but 6
. But the output above returns 10
.