Expression Evaluation

Advertisements

Prev Tutorial Next Tutorial

Expression Evaluation in C++

In c language expression evaluation is mainly depends on priority and associativity.

Priority:

This represents the evaluation of expression starts from "what" operator.

Associativity:

It represents which operator should be evaluated first if an expression is containing more than one operator with same priority.

OperatorPriorityAssociativity
{}, (), []1Left to right
++, --, !2Right to left
*, /, %3Left to right
+, -4Left to right
<, <=, >, >=, ==, !=5Left to right
&&6Left to right
||7Left to right
?:8Right to left
=, +=, -=, *=, /=, %=9Right to left

Example 1:

evaluate expression in c++

Example 2:

evaluate expression example in c++
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements