top of page

Operators &expressions in C++

 

  • Operators are the symbols (or keywords sometimes )that represents specific operations .

  • Arithmetic operators carry out arithmetic for C++ .These are unary +,unary -,+,-,*,/,and%.

  • The increment and decrement operators (++ and ---) add 1 or subtract 1 from operands value.

  • The increment and decrement operators come in two forms :postfix as in (a++ or a--) and prefix as in (++a or --a)

  • The postfix version-use and change rule

  • The prefix version -change and then use rule

  • Relational operators compare the values of thei operands .These are <><=>=

  • Logical operators connnect the relationships amoung values .These are!! etc.

  • The conditional operator ?: requires three operands ,that is a ternary operator. its general form is expr1?expr2:expr3.It gives the value of expr 2cif  expr1 evaluates to true otherwise it gives the value of expr 3.

Chapter 8- Operators and Expressions

Precedence of operators 

  • w-facebook
  • Twitter Clean
  • w-googleplus
bottom of page