I have been performing bitwise operation on a variable.
int p=3,q=5;
int a=~p,b=~q; //complement a and b
printf("%d %d\t%d %d",p,a,q,b);
The theoretical output for 'b' is 10 and in case if it's signed, it has to be -2. But the output is -6.
Can someone explain me the working of it?