S
silpau
hi,
i am a bit confused on expression evaluation order in expressions
involving unary increment.decrement operators along with binary
operators.
For example in the following expression
x += i + j + k++;
is the following the sequence of evaluations
1) as ++ has highest precedencce subexpression k++ gets evaluated
2) i + j is evaluated next and say the result is stored in a temporary
location say temp
3) next temp + k++ gets evaluated and result stored in temporary
location say temp1
4) next x + temp1 gets evaluated and the result is assigned back to x.
So is the sequence of evaluations correct or am i missing out
something here?
Would it be correct to assume tht given an expression all unary
oerators are evaluated followed by evaluation of binary operators
thanks,
silpa
i am a bit confused on expression evaluation order in expressions
involving unary increment.decrement operators along with binary
operators.
For example in the following expression
x += i + j + k++;
is the following the sequence of evaluations
1) as ++ has highest precedencce subexpression k++ gets evaluated
2) i + j is evaluated next and say the result is stored in a temporary
location say temp
3) next temp + k++ gets evaluated and result stored in temporary
location say temp1
4) next x + temp1 gets evaluated and the result is assigned back to x.
So is the sequence of evaluations correct or am i missing out
something here?
Would it be correct to assume tht given an expression all unary
oerators are evaluated followed by evaluation of binary operators
thanks,
silpa