[DUPLICATE] Please explain me how the following code works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

[DUPLICATE] Please explain me how the following code works?

int x=1,y=1,z=1,t=1; int sum1=++x + x++; //sum1=5 int sum2=y++ + ++y; //sum2=4 int sum3=++z + ++z; //sum3=6 int sum4=t++ + t++; //sum4=3

1st Apr 2018, 1:28 PM
Amirashkan
Amirashkan - avatar
1 Answer
+ 15
When two or more increment or decrement are applied in C++... it depends on compiler... most of the time the value varies for such expression... since there is no such standard developed to handle multiple increment/ decrement on the same line in C++... https://www.sololearn.com/Discuss/205998/?ref=app
1st Apr 2018, 1:40 PM
๐ŸŒ›DT๐ŸŒœ
๐ŸŒ›DT๐ŸŒœ - avatar