Bitwise operator and Boolean operator in C Program | Tutorials for beginners | Codingclasspoint

8. Bitwise Operator 



Bitwise operator permit programmer to access and manipulate of data at bit level. Various bitwise operator enlisted are 

one's complement  (~) 

bitwise AND  (&) 

bitwise OR (|) 

bitwise XOR (^) 

left shift (<<) 

right shift (>>) 

These operator can operate on integer and character value but not on float and double. In bitwise operator the function showbits( ) function is used to display the binary representation of any integer or character value. 

In one's complement all 0 changes to 1 and all 1 changes to 0. In the bitwise OR its value would obtaining by 0 to 2 bits. As the bitwise OR operator is used to set on a particular bit in a number. 

Bitwise AND the logical AND. It operate on 2operands and operands are compared on bit by bit basic. And hence both the operands are of same type.

Logical or Boolean Operator

Operator used with one or more operand and return either value zero (for false) or one (for true). The operand may be constant, variables or expressions. And the expression that combines two or more expressions is termed as logical expression. C has three logical operators :

Operator     Meaning 

 &&             AND 
 ||                 OR 
 !                 NOT 

Where logical NOT is a unary operator and other two are binary operator. Logical AND gives result true if both the conditions are true, otherwise result is false. And logial OR gives result false if both the condition false, otherwise result is true.

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.