In this short post i will be going to discuss What is logical operator ? in C language in details so stay with this article if you want to clear your doubt related to Logical Operator.
What is logical operator in C language?
The logical operators in C language are used when we want to test condition and make decisions.
C-language support three types logical operators:
- && meaning logical AND.
- || meaning logical OR.
- ! meaning logical NOT.
The logical operators && and || are used when we want to test more than one condition and make decisions.For example,
a>b && x==10
An expression of this kind,which combine two or more relational expression,is termed as a logical expression or compound relational expression. Like the simple relational expression, also yield a value of one or zero, according to the truth table.
Truth table of logical AND(&&) operators:
In case of logical AND(&&) operator result will be true(non-zero) when both inputs are true(non-zero) other wise result will be false(zero).
In this table 1 is stand for non-zero(true statement) value and 0 is stand for zero (false statement)value.
Truth table of logical OR(||) operators:
In case of logical OR(||) operator result will be false(zero) when both inputs are false(non-zero) other wise result will be true(non-zero).
In this table 1 is stand for non-zero(true statement) value and 0 is stand for zero (false statement)value.
Truth table of logical NOT(!) operators:
In case of logical NOT(!) operator the result will be true(non-zero) when input are false and vice versa.
In this table 1 is stand for non-zero(true statement) value and 0 is stand for zero (false statement)value.
Conclusion:
In this article we have studied about logical operators with truth table in detail,I hope you have no any doubt left related to this topic but if you have any queries then ask in comment section.


.jpg)
