# What does evaluation mean? post, pre ++ --

Chandra Bhatt
Ranch Hand
Posts: 1710
Hi,

Could anybody make me understand what does evaluation mean? It is said, the expression is first evaluated from left to right ... Is value is put at the time of evalution. Give a example please.
Little descriotion would be appreciated.

Thanks and Regargs,
cmbhatt

Deepak Bala
Bartender
Posts: 6663
5
An opration like variable++ would change the value of the variable in the next line. An operation like ++variable will change the value of the variable immediately on the same line.

int x=0;
x++; - value of x is 1 in the next line
int y=0;
++y; - value of y is 1 here

Chandra Bhatt
Ranch Hand
Posts: 1710
Thanks John,

Does next line increment also include the same line in postfix while there are sevaral post increment operaions like:

int x=1;
int y= x++ + x++ + ++x + x++;

Please clarify, how will the above expression be "evaluated"?

Thanks and Regards,
cmbhatt

chintan ramavat
Ranch Hand
Posts: 134
Its very important to make it clear

x = 3

y = x ++ ; // y = 3 ;
y = ++ x ; // y = 4 ;

value wont be incremented in the first expression but in the second it will be incremented first and then assigned to x.

hope it helped
chintan

marc weber
Sheriff
Posts: 11343
Originally posted by Chandra Bhatt:
...how will the above expression be "evaluated"?

Chandra Bhatt
Ranch Hand
Posts: 1710
Thanks Marc,

The way you answered was what I expected.

Thanks and Regards,
cmbhatt