Logical Operators
Logical operators are usually used to convey whether a given condition is true or false.
Since C language does not have data type to convey true and false, C uses a non-zero number as true while false is represented as zero, 0.
There are 3 logical operators: NOT, AND , OR.
The NOT logical operator is denoted as !
The AND logical operator is denoted as &&
The OR logical operator is denoted as ||
The following truth tables clearly explain the usage of the 3 logical operators.
NOT (!)
No comments:
Post a Comment