Operators


                                                Operators

                               As we see the word operator one question arrise in our mind is that, what is operator?So now we are going to talk about some operators,their types and their use.

OPERATORS:It is an symbol which instruct the computer to do mathematical and logical operations.There are 8 main types of operators and their classification is as below.
                 [1]. Arithmetic Operator
                 [2]. Relational Operator
                 [3]. Logical Operator
                 [4]. Assignment Operator
                 [5]. Conditional Operator
                 [6]. Bitwise Operator
                 [7]. Incrment and decrement Operator
                 [8]. Special Operator


Now we are going to study all this operators in detail with some intresting examples.
[1]. Arithmetic Operators:Arithmetic operators are used to perform arithmetic operations like
+,-,*,%,/,.All the data types that are used in C supports all this arithmetic operators.All the arithmetic operators with their meaning are mentioned in the table given below;

------------------------------------------------------------------------------------------------------------
                     OPERATORS                                            MEANING
                             +                                                      Addition or unary plus
                             -                                                       Subtraction or unary minus
                             *                                                       Multiplication
                             /                                                       Division
                             %                                                     Modulo Division
------------------------------------------------------------------------------------------------------------*****REMARK*****
[1]. Modulo division produces the reminder of an integer division.And it is never used in floating point data.
[2]. The output of the syntax depends on the precision of the operators and according to the direction of executation.
[3]. If we are using both the operands as integer and do the division the the frictonal part will be deleted.To get the exact output the operands must be in floating point data type.

E.g.                         a-b       a+b
                               a*b       a/b
                               a%b      -a*b
           Here a and b are the operands.Arithmetic operators are divided into three sub parts.
                                 [A]. Integer Arithmetic
                                 [B]. Real  Arithmetic
                                 [C]. Mixed-mode Arithmetic
[A]. Integer Arithmetic:If we are using both the operands as integer the expression generated using them will be integer expression and the operation will be integer arithmetic expression.The value of the largest integer operand depends on the machine.Let us consider to operands a and b and their integer values are simultaneously 3 and 2.Performing all the above arithmetic operators on them,the outputs are as below;
                                           a+ b=5
                                           a-b=1
                                           a*b=6
                                           a/b=1(Actually the o/p is 1.5 but due to integer type frictional part
                                                      0.5 is deleted.)
                                           a%b=1(reminder of the integer division)
During the integer division, if both the operands are of the same sign ,the the output will be zero.If one of them is negative, then direction of truncation is implementaion dependent ;
                                      3/2=0 and -3/-2=0
                                      -3/2=1 0r 0 (o/p will be machine dependent)
During the modulo division the sign of the output is always the sign of the first operand.


[B]. Real Arithmetic:If all the operands are real operands then it is called real arithmetic.A real                                 operand may assume values either in decimal or exponential notation.

[C]. Mixed-mode Arithmetic:When one of the operand is integer and the other one is real then                                               the operation is mixed-mode arithmetic operation.

E.g.                                 3/2.0=1.5
                                       3/2=1

In our next we will discuss about other remaining operators.So stay tuned............

Comments