operator-Any symbol that performs certain operations.e.g.+,-,*,/,%,==,<=,>=.!=.
Operand– Data or variables upon which the operator performs its operations.
Expression-Logical combination of operator and operands that performs a single statement. C=a+b.Where c ,a,bis operand,= and + are operator and whole is known as equation.combination of operators and operands according to the syntax of programming language.
Types of operators:
I)On the basis of operand:
i.Unary operator: It takes single operand.Unary plus(+) ,unary minus(-),increment(++),decrement(–).int a=s,printf(“a=%d”,a),printf(“a=%d”,a++),printf(“a=%d”,a–).
ii.Binary operator: It takes two operands.e.g: addition(+),subtraction(-).multiplication(*),division(/),modular division(%),greater than(>),less than(<),equals to (==) etc.
iii.Tertiary operator: It takes three operande.g:conditional statement(?:),first exp? exp2:exp3 int a,b,c a=6 b=9 c=a<b?b:a;
II)On the basis of function/Operation:
i.Arithmetic operator:+,-,*,%,/
ii.Relational operator:==,<,>,<=,>=,!=.
iii.Logical operator: &&-AND,||-OR,!-NOT.
iv.Assignment operator : =,+=,-=,*=,/=.
v.Increment operator/Decrement operator: ++,–
vi.Conditional operator: ?:
vii.Bitwise operator: &-Bitwise AND,>>-Shift right,<<-Shift left,|-Bitwise OR,^-Bitwise XOR
viii.Special operator: ,-Comma,*-pointer operator,size of -size of operator
Precedence and Associativity :
precedence- priority given to an operator while evaluating an expression.
Associativity- The order of evaluation of operators having the same level of precedence i.e.either left to right or right to left.
Precedence level Operator Description Associativity
- () function call left to right.
- [] Array element reference left to right.
-
+ Unary plus right to left
- – Unary minus ” ” ”
- ++ increment ” ” ”
- — decrement right to left
- ! Logical negation ” ” ”
- * Pointer reference ” ” ”
- & address(in direction) ” ” ”
- size of size of an object ” ” ”
- (type) type cost ” ” ”
-
* Multiplication left to right
- / Division ” ” ”
- % Modulus ” ” ”
-
+ Addition left to right
- – Subtraction ” ” ”
-
<< Left shift left to right
- >> Right shift ” ” ”
-
< less than left to right
- > greater than ” “” “”
- <= less than or equals to ” ” ”
- >= greater than or equals to ” ” ”
-
= equals to left to right
- != not equal to left to right
-
^ Bitwise XOR left to right
-
| Bitwise OR left to right
-
&& Logical AND
-
|| Logical OR
-
?: conditional expression
-
= %= Assignment operators left to right
- x= /= ” ” ”
- &= ^= ” ” ”
- |= <<= ” ” ”
- >>= ” ” ”
-
, Comma operator left to right
thanks for all information.