Thursday, March 8, 2012

TYPE OF OPERATOR C++ Programing Language part 3 : Bitwise operators

Bitwise operators
Bitwise operators are used to manipulate data in the form of bit.

TYPE OF OPERATOR C++ Programing Language part 3 : Bitwise operators

>> Bitwise  Operators  << (Shift Left)

Bitwise Left Shift Operator << is used to shift a bit to the left
Example: 0001 0101 = 21 if the shift left 1 bit 0010 1 010 = 42


>> Bitwise Operators >> (Shift Right)
Bitwise Shift Right operator >> is used to shift a bit to the right
Example: 0001 0010 = 18 if it is shifted to the right 2 bits 0000 0100 = 4


>> Bitwise operators & (AND)
Bitwise operators & (AND) is used to compare the bits of two operands. Will be true (1) if all the operands are combined is true (1).


>> Bitwise Operators | (OR)
Bitwise Operators | (OR) was used to compare the bits of two operands. Bernilain be true if either operand is combined there is a value true (1).


>> Bitwise operators ^ (XOR)
Bitwise operators ^ (XOR) is used to compare the bits of two operands. Bernilain be true (1) if there is one two-bit operand is compared to only a true value (1).

0 comments:

Post a Comment