# C – Compound Assignment and Bitwise operators

• Compound assignment operators reduce the size of modify expression.
• Operators are +=, -=, *=, &&=, >>=

Bitwise operators:

• These operators convert the input into binary data and perform operations.
• Operators are,
• Bitwise AND (&)
• Bitwise OR (|)
• Bitwise XOR (^)
• The following table explains the how Bitwise operations returns the results.

Truth table:

Note: After performing bitwise operations, results will be displayed in Decimal format only.

Bitwise – AND operator:

Bitwise – OR operator:

Bitwise – XOR operator:

Bitwise Complement Operator (~): It changes 1 to 0 and 0 to 1.

For example:

The bitwise complement of 35 (~35) is -36 instead of 220, but why?

Answer: It is the value of 2’s complement

2’s Complement:

• The 2’s complement of a number is equal to the complement of that number plus 1.
• Bitwise Complement of Any Number N is -(N+1).

Formula of 2’s complement:

Program to understand Bitwise complement operator:

Scroll to Top