Bitwise operators in C perform operations on individual bits of integer values. They are commonly used for low-level programming, optimization, and bit manipulation tasks. The main bitwise operators in C are:
1. AND (&): Sets a bit to 1 if both corresponding bits are 1.
2. OR (|): Sets a bit to 1 if at least one corresponding bit is 1.
3. XOR (^): Sets a bit to 1 if the corresponding bits are different.
4. NOT (~): Inverts all the bits.
5. Left Shift (<<): Shifts bits to the left, effectively multiplying the number by 2.
6. Right Shift (>>): Shifts bits to the right, effectively dividing the number by 2.
Bitwise operations are efficient for tasks like setting, clearing, or toggling specific bits in a number.