What's the definition of the answer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the definition of the answer?

int x=8; int y=7; x++; x+=y- -; The result 16, why not 15?

15th Nov 2022, 12:10 PM
C>>>
C>>> - avatar
1 Answer
+ 2
int x = 8, y = 7; x++ ; // x = 9 x += y--; => x = x+y => 9+7 = 16 , because you is post decrement. y-- => y = 6 Learn about difference between postfix and prefix increment/decrement operators.. Hope this helps you... https://www.sololearn.com/Discuss/1690694/?ref=app Pls do search. Search bar will provide you lot of similar questions... https://www.sololearn.com/discuss/3027476/?ref=app
15th Nov 2022, 12:16 PM
Jayakrishna 🇮🇳