What is the difference between ++a and a++. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between ++a and a++.

I am learning javascript please clear my the doubt with simple example

13th Jul 2017, 4:39 AM
Irfan ali
Irfan ali - avatar
3 Answers
13th Jul 2017, 5:12 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
https://www.sololearn.com/discuss/531271/?ref=app
13th Jul 2017, 5:30 AM
Ermyas
Ermyas - avatar
+ 4
++a increments the value of a at the same instant as its executed ,but a++ will increment the value of a after its used once. ex: int a,b; a=7; b=++a; cout<<b; //this will return 8. but, b=a++; cout<<b; //this will return 7only .
13th Jul 2017, 4:47 AM
Shantanu