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);
}

1 comment:

  1. Thanks for every other magnificent article. Where else may just anyone get
    that kind of info in such a perfect method of writing?
    I've a presentation next week, and I am at the search for such info.

    Check out my blog post nytimes626.com

    ReplyDelete