Yep, these expressions are undefined and shouldn't be depended on. There have been several threads on this already. You might want to search around the C++ forum for them.
can any one have any link which tells what ansi c have to say about it
because these expressions are aolved in 3 manners only
1)the turboc3 way
2)gcc way
3) let us c way
1)turboc and mcrosoft
y=(++i)+(i++)+(i++)+(++i);
first new value is calculated
there are 2 (++i) so the value of i is increased at the position and then new value of i becomes 7 now the new expression becomes
y=7+7+7+7;
y=28;
2)gcc
left to right
y=6+6+6+7;
when ++i is observed the value is ioncreased then n ther and is fed in calculation
for i++ its increased after ';' operator
so we get
y=25;
3) let us c way
right to left way
but i++ value also increases after one operator
y=9+7+6+6;
y=28;
this is a bit complex then other
y=(++i)+(i++)+(i++)+(++i);
left<-----------------------right
when ++i is observed value is increased then n there
when i++ is observed value is increased after next operator what ever the next operator may be
now i want to know which one is the standard one and is used by c99 or ansi c because it creates ambiguous situations