Am I correct? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Am I correct?

int b=2 int i=5 i += ++i *b cout<<i 1) Calculate ++i*b first: (5+1)×2=12 2) Then the value of i becomes 6 So 12+6=18 The answer will be 18?

7th Jul 2019, 1:24 PM
Winnie Sheng
Winnie Sheng - avatar
1 Answer
+ 5
You can try it out in the SoloLearn playground. The big question here is which operator comes first: multiplication or increment
7th Jul 2019, 3:15 PM
Zeke Williams
Zeke Williams - avatar