CS31: Bit Shifting

logical and arithmetic shift
Left Shift: <<, always adds zeros on the right, shifting all other bits left.

Right Shift: >>, add bits on the left, shifting all other bits right. In the case of unsigned types, the bit inserted on the left is always a zero, just like left shift. For signed types, the bit is usually the sign bit, which may be either zero or one. The qualifier usually is because the C language does not actually specify what to do in this case, and the compiler can choose which behavior to implement. That said, most compiler choose to perform arithmetic right shift and insert the sign bit on the left.

Code below Program output