what is the result stored in x after evaluating the following expression int x=5; x= x++*2+3*--x; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

what is the result stored in x after evaluating the following expression int x=5; x= x++*2+3*--x;

please explain the answer also

21st May 2019, 12:11 PM
Aman Kumar
Aman Kumar - avatar
1 Answer
+ 6
x++ =5 so.. 5*2 = 10 (x=6 here the increment happends after the value is used) 3*5 ➡(1 is taken from x first before the value is used this is why its 5 again) 5*2 = 10 3*5 = 15 x = 25
21st May 2019, 12:23 PM
D_Stark
D_Stark - avatar