i have read lots of stuff about ++x(pre) and x++(post) increments n decrements i need a totally simple explanation about that | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

i have read lots of stuff about ++x(pre) and x++(post) increments n decrements i need a totally simple explanation about that

cpp

6th Sep 2017, 10:30 AM
Avinash Talpade
Avinash Talpade - avatar
2 Antworten
6th Sep 2017, 10:32 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
++x means increment and then return x++ means return and then increment Example: int x = 0; int y = 0; cout<<x++ //prints 0 because x was returned before incrementing it cout<<++y //prints 1 because y was incremented before returning it
6th Sep 2017, 11:03 AM
Daniel de Lizaur