+ 1

[DUPLICATE] What is difference between x++ and ++x

29th Jan 2018, 7:48 PM
Darko Pavlovic
Darko Pavlovic - avatar
3 Answers
+ 5
y = x++ first y=x and then x = x+1 y = ++x first x = x+1 and then y = x
29th Jan 2018, 7:53 PM
davy hermans
davy hermans - avatar
+ 2
Cout<<x++ //it will print x, because post-increment is done after the statement is complete Cout<<++x//it will print x+1 because pre-increment is done first, and then statement second
29th Jan 2018, 9:33 PM
Milan Srdić
Milan Srdić - avatar