DSA- XOR Bitwise Operation | Binary

Kapil Patel
May 20, 2023

I believe you are already aware of AND, OR, and NOT operations.

XOR takes two arguments and returns result.

If both the arguments are same, it results as 0 (Zero or false).

If the arguments are different then it results in 1 (True).

See below truth table:

Above information is enough for you to use in DSA. Follow along to learn more.

C++

int a = 1;
int b = 1;

cout << "a ^ b = " << (a ^ b) << endl;

--

--

Kapil Patel

Software engineer | loves working in a startup like environment