Why is the output shows 24 and 37? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is the output shows 24 and 37?

https://code.sololearn.com/c6Qq9fiR7OYU/?ref=app and pls tell me post increment and pre increment in detail

23rd Jun 2017, 9:16 AM
Nitin Singhal
Nitin Singhal - avatar
1 Answer
+ 22
++a + ++a will ve treated differently by different compilers. Here it becomes 12 and the addition is done.. In some you can get 23 as output while also 24(as in this case is possible) And 37 will be final value of a + b. //you know this though.. As for pre and post increment/decrement.. search the question in Q&A section.. It has been asked like thousands of times... https://www.sololearn.com/Discuss/480118/?ref=app
23rd Jun 2017, 10:37 AM
Frost
Frost - avatar