0

Why do we get zero for the below equation as we know, 1^1=1 ?

int x = 1; x^=1; cout << x; output ------------- 0

28th May 2017, 6:20 PM
John Watson
John Watson - avatar
1 ответ
+ 3
The "^" is not "to the power of" in most programming languages. https://stackoverflow.com/questions/14526584/what-does-the-xor-operator-do Try: C++: pow(1,1); or JS: Math.pow(1,1);
28th May 2017, 6:35 PM
Joseph P French
Joseph P French - avatar