**What is an operator?**

An operator is a symbol that instructs C to perform some operation on one or more operands. An operand is something that an operator acts on.

The different types of operator:

**Arithmetic operator:**it is the basic and common operations and it is used to perform mathematical operations. It is known as binary operator since they take two operands to be evaluated. Different arithmetic operators are:

operator | symbol | Example |

Addition | + | x+y |

Subtraction | – | x-y |

Multiplication | * | x*y |

Division | / | x/y |

modulus | % | x%y |

- Relational operator: C’s relational is used to compare expressions. It is used in conditional statement. Different relational operators are:

operator | symbol | Example |

Equal | == | x==y |

Greater than | > | x>y |

Less than | < | x<y |

Greater than or equal to | >= | x>=y |

Less than or equal to | <= | x<=y |

Not equal to | != | x!=y |

- Logical operator: C’s logical operators let you combine two or more relational expression into a single expression that evaluates to either true or false. Different logical logical operators used are:

operator | symbol | Example |

AND | && | Exp 1 && exp2 |

OR | || | Exp 1 || exp2 |

NOT | ! | ! exp 1 |

- Assignment operator: The assignment operator is used to assign a value to a variable. The form is as follows:

Variable = expression:

Some assignment operator are: +=,-=,/=,%=.

The symbol = is used as assign operator.

- Increment/decrement operator:

operator | symbol | action | Examples |

Increment | ++ | Increment the operate by one | ++x, x– |

Decrement | — | Decrement the operate by on | –x, x++ |

- Ternary operator (condition operator): The ternary operator is C’s only ternary operator, meaning that it takes three operand, its syntax is

Exp1? Exp2:exp3;

It is used for conditional statement.

For example:

If(x>y)

z=x;

Else

z=y;

can be written as z=(x>y)? x: y;

- Comma operator: It permits two different expression to appear in situation where only one expression to appear in situation where only one expression would ordinarily be used.

Example:

{

Int a,b,c;

C = (a=10,b=20,a+b);

Printf (“= %d”,c);

}

Please follow and like us: