# Bitwise operators in c

these are used to perform calculations on binary numbers. addition, subtraction, addition and division are done in bit-level which makes processing faster and saves power

operator | meaning |
---|---|

& | Bitwise AND |

| | Bitwise OR |

^ | Bitwise exclusive OR |

~ | Bitwise complement |

>> & | Shift right and left |

##### Bitwise AND operator &

the output of bitwise AND will be 1,if the both operands are 1 ,if either any one is 0 , the result of corresponding to that bit is evaluated to 0.

##### Bitwise OR operator |

this will return 1 ,when any one of the input is 1,otherwise returns zero.

##### Bitwise XOR (exclusive OR) operator ^

this returns 1,when the two operands are different ,but it both are same it returns 0

##### Bitwise complement operator ~

this is an unitary operator,works on one operand . It changes the 1 to 0 and 0 to 1. It is denoted by ~.

##### Right Shift Operator >>

this is used to shift the bits in a given binary number towards right in a required no of positions ,denoted by >>

##### left shit operator

Left shift operator shifts all bits towards left by certain number of specified bits. It is denoted by <<.

example:

output: