+ 3
Confused in post and prefix increment
c++ operator
3 odpowiedzi
+ 18
c++ use the value first then increase 1
++c increase 1 and use the new value
+ 2
The pre increment first add 1 and then give the value whereas post increment first give the value and then add 1 to it.
This will be more clear from the example
x=10
y=x++
in this y will get value 10 and then x will get increment to 11
x=10
y=++x
now first the x will get increment to 11 and then this value will be given to y
so y will get value 11