Logical operators
Before going any further, let's learn about a few logical operators. There are only three types of logical operators in C. They are, AND
, OR,
and NOT.
All three operators cover any logical operation. These operators help to remove complexities and shorten the code. Let's learn their symbols first:
Name |
Symbol |
Meaning |
|
|
This means, if all the conditions are true, then the condition is true. |
|
|
This means, if any of the conditions are true, then the condition is true. |
|
|
This operator reverses the condition. |
Now we will learn about the operators in detail.
AND operator
The AND
operator means if all the conditions fulfill the condition, the condition is true.
Let's look at an example.
Suppose, ...
Get Learning C for Arduino now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.