Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - Bitwise operators

Node:Bitwise operators, Next:, Previous:Machine-level operators, Up:Machine-level operators



Bitwise operators

C provides the following operators for handling bit patterns:


<<
Bit-shift left by a specified number of bit positions
>>
Bit-shift right by a specified number of bit positions
|
Bitwise inclusive OR
^
Bitwise exclusive OR
&
Bitwise AND
~
Bitwise NOT
<<=
Bit-shift left assignment (var = var << value)
>>=
Bit-shift right assignment (var = var >> value)
|=
Exclusive OR assignment (var = var | value)
^=
Inclusive OR assignment (var = var ^ value)
&=
AND assignment (var = var & value)

The meaning and syntax of these operators is given below.

Don't confuse bitwise operators (such as bitwise AND, &) with logical operators (such as logical AND, &&). Bitwise operators operate on each bit in the operand individually.

 
 
  Published under free license. Design by Interspire