Confused in post and prefix increment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Confused in post and prefix increment

c++ operator

16th Apr 2017, 9:01 AM
DOLA PEDA RAYUDU
DOLA PEDA RAYUDU - avatar
3 Answers
+ 18
c++ use the value first then increase 1 ++c increase 1 and use the new value
16th Apr 2017, 9:05 AM
Mohamed Asem
Mohamed Asem - avatar
16th Apr 2017, 9:02 AM
Tashi N
Tashi N - avatar
+ 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
13th May 2017, 4:51 AM
priyam chopra
priyam chopra - avatar