0

difference of x++ and ++x

What is difference between x++ and ++x?

23rd Oct 2016, 12:12 PM
eunho lee
eunho lee - avatar
4 Answers
+ 4
keep it simple ++x is prefix and x++ is postfix
25th Oct 2016, 9:52 AM
Moersy
Moersy - avatar
+ 1
++x will increment the value of x before it is called while x++ will increment it after for example int x=6; cout <<x++<<endl; cout <<x <<endl; this will output: 6 7
23rd Oct 2016, 1:40 PM
Daniel Rollins
Daniel Rollins - avatar
+ 1
Let a=1 Cout<<++a; Cout<<a; The output will be 2. 2. Now Cout<<a++; Cout<<a; The output is. 1. 2.
23rd Oct 2016, 2:40 PM
Jishnu
Jishnu - avatar
- 2
He asked explanation not full form
25th Oct 2016, 11:04 AM
Jishnu
Jishnu - avatar