What is the ans of a++ + ++a if a =10 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the ans of a++ + ++a if a =10

fast

24th Feb 2017, 8:44 PM
Krishan Nandan Goswami
Krishan Nandan Goswami - avatar
3 Answers
+ 2
actually in my book it is written that it will be undefined because it will show different results in different compilers
24th Feb 2017, 8:52 PM
Krishan Nandan Goswami
Krishan Nandan Goswami - avatar
- 1
Let's break it down, step by step: - a++ will first use the value of a, which is 10, and then increment it - next, ++a will first increment the value of a, and then use it So if we substitute a, we will have: 10 + 12 = 22
24th Feb 2017, 8:50 PM
Tomer