I am getting ans as 12,11,12 how it is compiling🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am getting ans as 12,11,12 how it is compiling🤔

https://code.sololearn.com/caCnBtLEy6oa/?ref=app

10th Dec 2017, 5:23 PM
Chandan B U
Chandan B U - avatar
3 Answers
+ 7
It's undefined behaviour, please don't do this, you're making me cry :'(.
10th Dec 2017, 5:26 PM
Dennis
Dennis - avatar
+ 3
pre increment is first increment the value by 1 then use it and in post increment first value is used then store a=10 a++=a+1=11 so a++=11 ++a=a+1=12 so ++a=12 and last value of a after increment is 12 so a=12 https://www.sololearn.com/discuss/489143/?ref=app
10th Dec 2017, 5:30 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
a++ means a=a+1 not a++=a+1
11th Dec 2017, 5:27 AM
Chandan B U
Chandan B U - avatar