Saturday, January 4, 2025
HomeQ&ABitwise Operators in C

Bitwise Operators in C

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.

See also  How do I get oil stains out of clothes?

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.

See also  What state is Washington, DC in, and is it still the capital?

Bitwise operations are efficient for tasks like setting, clearing, or toggling specific bits in a number.

 

RELATED ARTICLES

Leave a Reply

- Advertisment -

Most Popular

Who is Macei K?

Who is Jacquees?

Who is Sambucha?

Recent Comments