Shift Operators


Description

Shift operators shifts the binary bit value of a given number to left or right side.

Types

Left shift operator
  • It is represented by '>>' operator.
  • It shifts each bit to the left by adding 0 to the right of the binary number
  • Eg: Before - 0101001
    After - 1010010
Right shift operator
  • It is represented by '<<' operator.
  • It shifts each bit to the right by adding 0 to the left side.
  • Eg: Before - 0101001
    After - 0010100