OPERATORS OF C++ - Leo tutorials

Operator : An operators is a symbol that tells the computer to perform certain mathematical or logical manipulations. Operations are used in program to manipulate data and variables.
                 C++ operator can be classifies into a number of categories.
They include :

  1. Arithmetic operators
  2. Relational operators 
  3. Logical operators
  4. Assignment operators
  5. Increment and Decrements operators
  6. Conditional operators
  7. Bitwise operators
  8. Special operators
  9. Scope resolution operators
  10. Member dereferecing operators
  11. Memory management operators
  12. Manipulator
  13. The type cast operator

1.Arithmetic Operator : C++ provides all the basic arithmetic operators which can be listed as below:

                                Operator                                     Meaning 

                                         +                                      Adding or unary plus
                                         -                                  Subtraction or unary minus
                                         *                                      Multiplications
                                         /                                            Divisions
                                       %                                       Modulo division

These operators can operate on any built-in-datatype allowed in C. Integer division truncates any fractional part.The modulo division produces the remainder of an integer division. Example of arithmetic operators are:
a-b             a+b
a*b            a/b
a%b          -a*b

2.Relational Operators : The relational operator are used to compare two values. An expression such as a<b containing a relational operator is termed as relational expression. The value of relational expression is either onw or zero. It is one if the specified relation is true and zero if the relation is false.

3.Logical Operators : The logical operators && and :: are used when we want to test more than one condition and make decisions

4.Assignment Operator : Assignment operator are used to assign the result of expression to a variable C++ has a set of 'shorthand' assignment operators of the form 

5.Increment and Decrements Operator : The increments and decrements operators are 
          ++ and --
     The operators ++ adds 1 to operands while -- subtracts 1.Both are unary operators and taken the following form :
        ++m or m--
        --m or m--

Post a comment