Hi,
The following code prints -13.Am not sure y.
12 is 1100 in binary.Its one's complement is 0011. Should n't the answer be 3?Including the 5th bit,the complement would be 10011 which can be interpreted as -13(-16+3) or -19(-(16+2+1)).Whats the general rule used here and which bit is considered as the sign bit for a given number.
#include<stdio.h>
int main(void)
{
int b;
int a=12;
b=~a;
printf("%d\n",b);
}