int main() { int i=3; (i << 1); cout << i; //Prints 3 }
I expected to get 6 because of shifting left one bit. Why does it not work?
You should use <<= or the value is just lost.
<<=