There are 3 main Bitwise Operator | |
& | The bitwise AND operator |
| | The bitwise OR operator |
^ | The bitwise exclusive OR (XOR) operator |
Using AND Bitwise Operators:
x= y&zHere y and z are operands.
If y=2 and z=3
Decimal | Results | ||||
Expressions | Binary | Decimal | Binary | ||
2 & 3 | 0010 & 0011 | 2 | 0010 |
so the Ans is x= 2.
Program: |
void main( )
{
int x,y,z;
clrscr();
y=2;
z=3;
x= y&z;
printf("%d",x);
getch();
}
Output: | 2 |
0 comments:
Post a Comment