0
Operator precedence
Can someone please elaborate this program line by line double z = x++ - y * 7 / --y + x * 10;
2 Antworten
+ 1
Expression is evaluated from left to right..
So
x++ is replaced x, means in post increment first value is used then after increments so next x++ so x = x+1 now..
Next y*7 then --y
Then (y*7)/ (--y)
x - (y*7)/(--y) + (x+1)*10
Finally
For if x =2, y = 3
Then
2 - 3*7/(2) + (3)*10
=2-10+30=22 is the answer...