Showing posts with label XOR. Show all posts
Showing posts with label XOR. Show all posts

Tuesday, May 25, 2010

THE XOR OPERATION

The outcome of XOR operation is true only when one of the operand is true(but not both).

P                         Q                     P^Q
---------------------------------------------
1                          1                      0
0                          0                      0
1                          0                      1
0                          1                      1

int xor(int a, int b)
{
return (a||b) && !(a && b);
}