^
symbol stands for Bitwise Xor in C++, and in most programming languages. Refer Sample Code & Truth Table for better explanation. Also a^=b
is short hand for a = a^b
.
Sample Code
#include <iostream>
using namespace std;
int main() {
int a = 5, b = 9; // a = 5(00000101), b = 9(00001001)
cout<<int(a^b); // The result is 12(00001100)
return 0;
}
Truth Table