Introduction

Learn what bitwise operators are and how to use them in your programs.

Why are Bitwise operators needed?

Programming languages are byte-oriented, whereas computer hardware tends to be bit-oriented. Bitwise operators allow us to delve inside the byte and see how it is constructed and how it can be manipulated effectively.

Main types of operators

The following table shows the main bitwise operator types.

Operators Meaning
& AND
| OR
^ XOR
~ NOT
<< Shift Left
>> Shift Right

This chapter offers examples related to these operators so you can understand them in depth.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.