+ 5
Please explain how this works? What it means by (x++ >5) and all?
https://code.sololearn.com/c2Gxc4Tc4wr5/?ref=app https://code.sololearn.com/c33062IHpXYJ/?ref=app
12 Answers
+ 4
@McNitro,
x++ does the increment in the next line
For example:
int x=5;
cout<<x++;
//output 5
++x does the increment on that line
For example:
int x=5;
cout<<++x;
// output 6
+ 3
I just read my earlier response...pretty crappy. lol. I wasn't looking for further explanation of Pre vs Post definitions. @Gordie explained it well for @Rame#1, and everyone else. My question is more about implementation. I fail to understand the scenarios in which you would choose to implement one over the other.
+ 2
@Gordie Adding to Rame's question: What is a simple, "real world" example for differentiating between Pre (++x) and Post (x++)?
- 1
int, inostren
// example