Start here · Essential guide
Bitwise XOR in C++
Learn how the bitwise XOR operator (^) in C++ works, with a truth table, code examples, and common uses such as toggling bits and swapping values.
Syntax and Functions
XOR, NOT and the other bitwise operators, and how & differs from &&.
Start here · Essential guide
Learn how the bitwise XOR operator (^) in C++ works, with a truth table, code examples, and common uses such as toggling bits and swapping values.
Learn how the left shift (<<) and right shift (>>) operators in C move bits, with examples, pitfalls to avoid, and common uses like building bit masks.
Only the single & is bitwise. It compares integers bit by bit, while && is logical AND and checks true or false. Examples in C++ show the difference.
The bitwise NOT (~) operator flips every bit in a value. Learn what it does, how it treats signed and unsigned integers, and how to use it with examples.
Related topics