Operators are some symbol or word in C Program which give instruction to the compiler to do some mathematical or logical task.
EX : a+b
Here + is an operator.Data ,Variable and Expression where operator works on is called operand.Like a+b,here a and b is operand.
a + b
| | |
Operand Operator Operand
There are different type of operator in C.Like :
* Mathematical Operator
-> Unary Mathematical Operator
-> Binary Mathematical Operator
* Assignment Operator
* Logical Operator
* Relational Operators
* Conditional operators
* Bitwise Operators
* Special Operators
Mathematical Operators : Mathematical Operators are +, -,*,\ etc.
5 binary and 2 unary mathematical operators are available in C.
Binary Operators: It can work with two operand at a time.Binary Operators are :
Addition : +
Subtraction : -
Multiplication : *
Division : /
Reminder/Modulus : %
Unary operator : It can work with one operand at a time.They are :
Inorement : ++
Decrement : --
Unary minus : -
Assignment Operators : ( = ) is used as assignment operator in C.
Relational Operators : Relational Operators are used to compare two variable in C.Like
a < b
There are 6 relational operators in C.They are listed below :
Equal : ==
Greater than : >
Less than : <
Greater than or equal : >=
Less than or equal : <=
Not equal : ! =
Logical operator : Logical Operators are listed below:
Operator - Symbol - Example
AND - && - a>b && b>c
OR - | | - a>b | | b>c
NOT - ! - !a
Conditional Operator : Conditional operator can work with three operand at a time.
EX : c = ( a>b ) ? a : b
Post a Comment