What does ^ do in c++?

What does ^ do in c++?
I believe it is bitwise xor. This means that when you have the notation: x^y, x and y get translated to the binary system and the get xored per bit. An example:
Say we have 5^8:

6 ^ 10
110 ^ 1010

0110
1010
____ ^
1100

1100 translates to 12. So, 6^10 = 12.

(Xor: When only ONE bit is set, the output is true, else the output is false)

What is its use? Its often used for simple cryptography.
(Xor: When only ONE bit is set, the output is true, else the output is false)
Another way to look at it is that the set bits in the right hand operand flip the bits in the left hand operand.
1
2
3
4
5
a^b= c
0 0  0 (c=a)
0 1  1 (c=!a)
1 0  1 (c=a)
1 1  0 (c=!a)
In C++/CLI Programming, it is called tracking handles

String^ name;
Topic archived. No new replies allowed.