-
Bitwise operators
So I just finished reading the bitwise operators tutorial. I read that using the leftshift operators, one can raise a number to a power.
Code:
[variable]<<[number of places]
In my code I've done this:
Code:
printf("%d", 5<<2);
5 to the power of 2 is 5*5 which is 25 but the result is 20. Any reason why? Is there something I'm missing?
-
Never mind. Every move to the left is the the power of 2. I re-read the tutorial and picked up really fast. Sorry guys XD. Misread things.
-
1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
That's a computer!