Monday, May 16, 2016

Operators Evaluation From Left To Right & Right To Left

Hi All...!

Today I'm going to talk about "Operators Evaluation From Left To Right & Right To Left",
Let's see what it is,

All binary operators except for the assignment operators are evaluated from left to right, assignment operators are evaluated right to left.


Note
Binary Operators are the operators which has two operands in it's both sides.
Ex: 1 + 2  (+ mark has two operands in it's both left and right so + mark is a Binary Operator)


Let's go to today's topic,
All binary operators are evaluated from left to right except assignment operator 
(assignment operator is " = ").

Ex: 1+2 operates in this way 1 adding to 2

Assignment operator evaluate from right to left.

Ex: x = 1 operates 1 is assigning to x 
Let's see how following operation is evaluated

Ex: x = 1 + 2 operates in this way 1 adding to 2 then the result of that assigning to x

In there Black arrow take place in first, Then Red arrow happens.

See you soon...Bye

1 comment: