Logical Operators in C Language
Logical Operators
An expression containing logical operator returns either 0 or 1 depending upon whether expression results true or false.
Here above 3 Logical Operator are arrange in according to it's priority order i.e NOT>AND>OR .
NOT Logical Operator
EXAMPLE OF !
Example of ! operator |
OUTPUT :- 0
Note :- In the quotation given above, Output is zero because the ! is a unary operator so first of all, the !x has run and in place of !x the value come 0 then next expression i.e 0>4 is solve .
AND Logical Operator
syntax of && operator |
EXAMPLE OF &&
Example of && operator |
OUTPUT :- 0
NOTE:-- Here in above example y=x>4&&x<10 , first of all x>4 is solve because it's priority order higher then amongs all so in place of x>4 , 1 value is come then && operator run and 1<10 is false=0 so according to table if either of two statement value is zero so output will be zero.
OR Logical Operator
OR operator |
EXAMPLE of OR Operator
Example of OR operator |
Comments
Post a Comment