Difference between pre-increment and post-increment operator, also give actual scenarios where it can be used. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Difference between pre-increment and post-increment operator, also give actual scenarios where it can be used.

6th Apr 2017, 7:41 AM
MD SHEIKH AZARUDDIN
MD SHEIKH AZARUDDIN - avatar
3 Answers
+ 9
Differences : 1. Main difference is in the name. One starts with "pre" and another starts with "post". 2. Pre-increment increases first then deploys. and post-increment deploys first then increases value. 3. In pre-increment you need to write ++ operator before the variable and in post-increment you will need to write the ++ operator after the variable. 4. most of the people use post-increment in loops.
6th Apr 2017, 8:03 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 2
same problem here :(
6th Apr 2017, 7:52 AM
Izs_98