Operators


To be continued with Operators......

In this post we are going to take a brief look on the operators like increment and decrement operators, special operators and bitwise operators..................
[6].Increment and Decrement Operators:
                                                 

                                                      ++ and -- are increment and decrement operators simultaneously.Now let us consider a variable x,using x they arre denoted as below.
                                                        ++x or x++
                                                         --x  or x--
                                           ++x is equivalent to x=x+1.
                                            --x is equivalent to x=x-1.
 It means that increment operator add 1 in the value of the assumed variable and decrement operator subtract 1 from the value of the assumed variable.++x and x++ will perform the same operation on the value of the variable but method of performing operation is different.
     
     
              Now consider two variables z and x.
                                            x=7;
                                            z= ++x;
                       In this case  x will be incremented first so the value the value of x will become    8.After this the value of x is assigned to z so value of z is also 8.In the case on decrement operator if we are using --x then first x  is decremented by one and then it's value is assigned to z.

                                         Now if we are using z= x++;
                      In this case first the value of x is assigned to z, so the value of z will become 7 and after that x is incremented so x will be 8.In the case of decrement operator if we are using x-- the value of x is assigned to z first so z will be 7 .After this x is decremented by 1,so x will be 6. According to the position of the ++ and -- this operators are divided into two part.                          
                         (1)                      ++x         { Prefix increment operator and                                                                                      --x         {  Prefix decrement operator

                         (2)                      x++         { Postfix increment operator and
                                                   x--          { Postfix decrement operator
           
[7].Special Operators:C supports some special operators like comma operator,sizeof operator,
pointer operator and member selection operator.Comma operators are used to link the related operations together and sizeof operator is used to find the size of any type of data type.

Comments