The Shift Operators : shift operator « Operator « C# / CSharp Tutorial






  1. <<: Left shift
  2. >>: Right shift

The general forms for these operators are shown here:

value < num-bits 
value > num-bits
  1. A 'left shift' shift all bits to the left and a zero bit to be brought in on the right.
  2. A 'right shift' causes all bits to be shifted right one position.
  3. In the case of a right shift on an unsigned value, a zero is brought in on the left.
  4. In the case of a right shift on a signed value, the sign bit is preserved.
3.10.shift operator
3.10.1.The Shift Operators
3.10.2.Shift Operators in action
3.10.3.Shift Operators: shift left and right