I am currently learning C++. I was trying to compute power of an integer using the expression:
val=10^1;
Instead of expected answe
Because ^ is the exclusive or operator and not the exponentiation operator. Basically, because the last bit of 10 in binary is 0, by applying exclusive or of 1 the last bit gets converted to 1 because it is different than 0.