0

Operator precedence

Can someone please elaborate this program line by line double z = x++ - y * 7 / --y + x * 10;

18th Sep 2020, 7:54 AM
anshu kulshrestha
anshu kulshrestha - avatar
1 Odpowiedź
+ 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...
18th Sep 2020, 8:23 AM
Jayakrishna 🇮🇳