Bitwise Operation : Operators Introduction

Bitwise Operation and Operators Introduction

  1. Sometimes it is mandatory to consider data at bit level.
  2. We have to operate on the individual data bit.We have to turn on/off particular data bit, at that time we must use bitwise operator for doing this task.
  3. C Programming provides us different bits for manipulating of bits.

Note : Bitwise Operator

  1. C Programming provides us 6 operators for manipulation of data a bit level
  2. These operators operates on Integer,character but not on float,double
  3. Using Bitwise Operators we can manipulate individual bits

Following are 6 bitwise Operators :

Operator Name of Operator
~ One’s Compliment
>> Right Shift
<< Left Shift
& Bitwise AND
| Bitwise OR
^ Bitwise XOR

Rules of Bitwise Operators :

Input Bits AND OR XOR
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0

Summary :

  1. One’s Compliment Operator is used to turn on or off any individual bit.
  2. Right Shift and Left Shift Operator is used to shift bit.
  3. AND Operator is used to Mask Particular Part of the Bit Pattern.