I'm learning bitwise operation and i came across a xor operation,
#include<stdio.h>
#include<conio.h>
int main
{
printf("%d\n",10 ^ 9);
getch();
return 0;
}
the binary form of 10 ---> 1 0 1 0 the binary form of 9 ---> 1 0 0 1
So in XOR the output is 1 when one of the input is 1 and other is 0.
So the output of 10 ^ 9 is 0 0 1 1 => 3
So when trying for the -10 ^ 9, I'm getting the output as -1.
#include<stdio.h>
#include<conio.h>
int main
{
printf("%d\n",-10 ^ 9);
getch();
return 0;
}
Can some one explain me how it is -1?
Thanks in advance for all who helps!