0
Give output (step by step for me plz)
a+=a++ + ++a + --a + a--
2 Answers
+ 2
a++ + a-- = a + 1 + a - 1 = a + a
a = a(firt a) + a(a++) + a(++a) + a(a--) + a(a--)
a = a + a + a + a + a
result = 5a
+ 1
1. += to normal operator
a = a + a++ + ++a + --a + a--
2. a++ is just a when calculating.
a = a + a + ++a + --a + a--
3. ++a increments the value of a after ++a. Let's say b as a+1
a = a + a + b + --b + b--
4. --a decrements the valur of a after --a.
a = a + a + b + a + a--
5. a-- is just a when calculating.
a = a + a + b + a + a
a = a + a + (a + 1) + a + a
6. All the postfixs are ignored(I don't know why but it does. I think it does because it gives new value to a).
So new value for a will be (5 * a + 1)