List of operators used in C language are
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Assignment Operators
- Increment and decrement Operators
- Conditional Operators
- Bitwise Operators
- Special Operators
Relational Operators
Relational Operators are used to compare two numbers and take decisions based on their relation. Relational expressions are used in decision statements such as if, for, while, etc.,
< |
less than |
<= |
less than or equal to |
> |
greater than |
>= |
greater than or equal to |
== |
is equal to |
!= |
is not equal to |
Logical Operators
Logical operators are used to test more than one condition and make decisions.
&& |
logical AND (both conditions are non zero than true, either is zero then false) |
| | |
logical OR (both conditions are zero then false, either is zero then true) |
! |
logical NOT (condition is non zero then false, if zero then true) |
Conditional Operators
A ternary operator is known as a Conditional Operator.
exp1 ? exp2 : exp3 |
if exp1 is true then execute exp2 otherwise exp3 |
e.g.
x = (a > b) ? a : b;
which is same as
if( a > b )
x=a;
else
x=b;