+ 1
Confused with increment operators
Explain this please : ++i * 3 being equivalent to (i += 1) * 3, but not to i += 1 * 3 (which is equivalent to i += 3).. Confused with them!
2 Answers
+ 8
++i is equivalent to i=i+1,
So as you describe at 1st,
++i*3 is equivalent to (i+=1)*3, and not i+=1*3.
For pre increment and post increment confusions, refer-
https://code.sololearn.com/cjHQRJUG5NTf/?ref=app
+ 3
Thank you..Dat was an awesome piece of code :)