+ 1

What defferent between x++ ++x and x-- --x

25th Feb 2017, 4:07 PM
Mar1wan
Mar1wan - avatar
3 ответов
+ 6
an example with cout is clearer: int x = 1,y = 1; cout x++; // outputs 1 then increments x by 1 cout ++y; // increments y by 1 then outputs 2
25th Feb 2017, 6:10 PM
Norayr Gasparyan
Norayr Gasparyan - avatar
+ 3
++x increments the value of x and then returns x x++ returns the value of x and then increments example: x= 0 ; a=++x; b=x++; after the code is run both a and b will be 1 but x will be 2.h
17th Mar 2017, 10:34 PM
Aliyu Abdullahi Gital
Aliyu Abdullahi Gital - avatar
+ 2
x++ means display and then update ++x means update and then display for example ; say x=3; so if you do x++ ; it shows the output 3 and then updates its value to 4 whereas for ++x; it first updates to 4 and then displays 4;
25th Feb 2017, 4:16 PM
Ankit