Operators and Expressions



Definition


" Operators are the symbols which performs some operation on operands. "

Expreation is any valid combination of operators, constants and variables. "



Types of operators

There are two types of operators

     a) On the basis of type of operands 

              1- Unary operator
              2- Binary operator
              3- Ternary operator

     b) On the basis of type operation performed 
              1- Arithmetic operator
              2- Logical operator
              3- Relational operator
              4- Bit wise operator
              5- Assignment operator
              6- Increment and Decrements operator
              7- Shorthand operator
              8- Conditional operator







A)  On The Basis Of Type Of Number Operands


1- Unary Operator -
These are the operator which operates upon single operand.
Eg-  +5, +7, -6, -54.7, x++; y--   etc

2-Binary Operator -
These are the operator which operates upon two operands.
Eg-  5+7, 10-8, 15%3, x&&y, a||b   etc.

3- Ternary Operator -
It is the operator which operates upon three operads.It is also called Conditional Operator.
Eg- ?:  (Question mark and colon)




B)  On The Basis Of  Type Of Number Operands


1- Arithmetic Operator- 
These operator is used for the performing arithmetic operation in the Expiration.


2- Logical Operator- 
These operator is used to combine logical expiration.It works on Control Statement.

3- Relational Operator-
These operator is used to determine the relation among different operand.


4- Bitwise Operator- 
These operator is used as like gates. It works on mathematical expiration. 


5- Assignment Operator-
It is used to assignment value to a variable.
Eg-  x=5;

6- Increment and Decrement Operator- 




7- Shorthand Operator-
Is used to minimize code length.
8- Conditional Operator-
This operator is used like to select one thing from two things based upon the situation.
It is also called Ternary Operator.










Comments

Popular posts from this blog

Include Vs Import

Object Oriented Program (Paradigm)