increment operator- help me please

Newbie Member
2Oct2010,19:35   #1
ajayfame's Avatar
please help me with this.....

a=1;

b = a++ + ++a+ ++a;

the output is coming b=7...


can any1 plzz explain
Ambitious contributor
2Oct2010,21:35   #2
jimblumberg's Avatar
This is undefined behavior.
Read Stroustrup's answer to the a++ + ++a FAQ http://www2.research.att.com/~bs/bs_...aluation-order