1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ Inbuilt Operators

Discussion in 'C++' started by BiplabKamal, May 14, 2016.

  1. Basically computer programming is all about data and manipulation of data. The manipulation is called operation and operations are accomplished with the help of functions and operators. Like functions work with data, operators also work with data. The difference between functions and operators are that the operators are some special kind of functions with fixed special names matching with arithmetical and logical operator symbols like ‘+’, ‘-’,’*’ etc. Normal function names are identifiers and they cannot contain those symbols. Operator names and their meaning are predefined and the number of operands for each operator also fixed. For example addition operator + works on two variables and returns the addition result of the values of two variables. Also the operands of an operator have to be of same type. In built operators work on inbuilt data types only. You cannot create a new operator but for user defined data types you can extend the operators to support new types which we will discuss along with user defined data types in next chapters. In this chapter we will focus on the inbuilt operators in C++. Operators are classified in following groups-
    1. Arithmetic Operators
    2. Comparison Operators
    3. Logical Operators
    4. Bit-wise Operators
    5. Assignment Operators
    6. Conditional Operators
    7. Special Operators
    Following tables will give full information about the operators:

    Arithmetic Operators



    Arithmetic operators perform mathematical operations like addition, subtraction and multiplication

    [​IMG]

    Comparison Operators



    Comparison operators check the relationship between two operands and returns true or false if the relationship is true or false respectively. Comparison operators are used in decision making

    [​IMG]

    Logical Operators



    Logical operators are used in logical expressions. They are used in decision making

    [​IMG]

    Bit-wise Operators



    Bit-wise operators are used to do bit level operations.

    [​IMG]

    Assignment Operators



    Assignment operators are used to store the result of mathematical operation in one of the operand which is at left side of the operator.

    [​IMG]

    Conditional Operators



    Conditional operator is a ternary operator which has three expressions as three operands. The first operand is a boolean expression depending on which either of the other two expression is executed.

    [​IMG]

    Special Operators



    [​IMG]
     
    Last edited by a moderator: Jan 21, 2017
    shabbir likes this.

Share This Page