Bitwise Operators in C - Bitwise Operators
Learn C - C tutorial - bitwise operators in c - C examples - C programs
Bitwise Operators
- The bitwise operator’s logical counterparts, AND, OR and NOT operators.
- Bit wise operators perform on strings of eight bits at a time, instead of Performing on individual bits.
- In this byte is normally smallest unit of addressable memory.
Learn C - C tutorial - bitwise operators in c - C examples - C programs
Sample Code
#include <stdio.h>
int main()
{
unsigned char a = 0xAA;
if (a & 0x01)
printf("one - true\n");
else
printf("one - false\n");
if (a & 0x02)
printf("two - true\n");
else
printf("two - false\n");
return 0;
}
Output
one - false
two - true