### Bitwise operators

Bitwise operators perform manipulations of data at bit level. These operators also perform shifting of bits from right to left. Bitwise operators are not applied to `float`

or `double`

(These are datatypes, we will learn about them in the next tutorial).

Operator | Description |
---|

& | Bitwise AND |

| | Bitwise OR |

^ | Bitwise exclusive OR |

<< | left shift |

>> | right shift |

Now lets see truth table for bitwise `&`

, `|`

and `^`

a | b | a & b | a | b | a ^ b |
---|

0 | 0 | 0 | 0 | 0 |

0 | 1 | 0 | 1 | 1 |

1 | 0 | 0 | 1 | 1 |

1 | 1 | 1 | 1 | 0 |

The bitwise shift operator, shifts the bit value. The left operand specifies the value to be shifted and the right operand specifies the number of positions that the bits in the value have to be shifted. Both operands have the same precedence.

Example :

```
a = 0001000
b = 2
a << b = 0100000
a >> b = 0000010
```