0

Can anyone give detail explanation with an example of multiple assignment operators like X+=y-=10

18th Dec 2019, 10:53 AM
Lakshmi Reddy Sanikommu
Lakshmi Reddy Sanikommu - avatar
2 Respostas
+ 3
Here in your example: Every where in a program, RHS expressions are evaluated first. So like this if X=20,y=30; (X+=(y-=10)) X+=(y-=10) =>X=X+(y-=10) =>X=X+(y=(y-10)); =>X=X+(y=30-10); X=X+(y=20); X=X+20; X=20+20; X=40 Edit: in c,c++,java...
18th Dec 2019, 1:21 PM
Jayakrishna 🇮🇳
0
These things can be slightly different in different languages. The keyword you have to google for here (in combination with your language) is: operator precedence
18th Dec 2019, 4:18 PM
HonFu
HonFu - avatar