Easy learning with example program codes

CPP Operators

CPP Operators are used to perform operations on operands. Operands can be a variable or a constant. The operators are divided into various groups on the basis of the basic operations they perform.


Some of the basic operators are:

Arithmetic Operators:

The operators which are used to perform the arithmetical operations, are grouped together as Arithmetic operators.

Operators Symbol
Addition +
Multiplication *
Division /
Modulus %


Assignment Operators:

The operators which are used to assign values to a variable, are grouped together as Assignment operators.

Operators Symbol
Equals To =
Added Value +=
Subtracted Value -=
Multiplicated Value *=
Divided Value /=
Modulus Value %=


Comparison Operators:

The operators which are used to compare two values, are grouped together as Comparison operators.

Operators Symbol
Equal ==
Not equal !=
Greater than >
Less than <
Greater than or equal to >=
Less than or equal to <=


Logical Operators:

The operators which are used to perform logical operations, are grouped together as Logical operators.

Operators Symbol
AND &&
OR ||


Precedence and Associativity of C Operators:

The precedence and associativity of different types of operators in CPP are listed below.

Postfix Operators () [] -> . ++ – – Left to Right
Unary Operators + – ! ~ ++ – – (type)* & sizeof Right to Left
Multiplicative Operators * / % Left to Right
Additive Operators + – Left to Right
Shift Operators << >> Left to Right
Relational Operators < <= > >= Left to Right
Equality == != Left to Right
Bitwise AND & Left to Right
Bitwise XOR ^ Left to Right
Bitwise OR | Left to Right
Logical AND && Left to Right
Logical OR || Left to Right
Conditional Operator ?: Right to Left
Assignment Operators = += -= *= /= %=>>= <<= &= ^= |= Right to Left
Comma , Left to Right


#include <iostream.h>
using namespace std;
int main()
int sum1 = 10+20*10-90*10+700;  
int sum2 = (10+20)*10-(90*10)+700;
cout << sum1 << endl;
cout << sum2;
return 0;


Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki