+ 4
[CLOSED] Why is this happening?
Saw this in a challenge question. cout << (1 << 1) Output: 2 I tried it again and... cout << (1 << 2) Output: 4 I was never taught this...
3 Answers
+ 5
Left shift by one is equivalent to multiplication by two.
+ 2
Martin Taylor Thank you! That makes sense now. I wish they could've put that SOMEWHERE, but that's ok. :)