0
1.3kviews
Explain following bitwise operator with example:-

(i) Bitwise Right shift operator

(ii) Bitwise X-OR operator


1 Answer
0
10views

i) Bitwise Right Shift Operator in C

  • It is denoted by >>

  • Bit Pattern of the data can be shifted by specified number of Positions to Right

  • When Data is Shifted Right , leading zero’s are filled with zero.

  • Right shift Operator is Binary Operator [Bi – two]

Example:

Original Number A 0000 0000 0011 1100
Right Shift by 2 0000 0000 0000 1111

ii) Bitwise XOR – ^

Bitwise XOR ( ^ ), takes 2 bit patterns and perform XOR operation with it.

     0101
    0110
    ------
XOR    0011
    ------

The Bitwise XOR will take pair of bits from each position, and if both the bits are different, the result on that position will be 1. If both bits are same, then the result on that position is 0.

Please log in to add an answer.