Discussion in 'C' started by eilon, Aug 29, 2014.
i have this code
now j become 25, why?
cant explain it, why not 4*5=20?
Because value is incremented and then applied to the expression.
It also depends on parser to parser but most of them would result in 25
The behaviour is undefined. All the standard says about preincrement is that the variable is incremented before it is used; it does not say WHEN it is incremented. So it could be equivalent to 4*5 as you expect, but it could equally be equivalent to ++x; ++x; int j=x*x; which gives 25.
Separate names with a comma.