How are pre/post increment operators different? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How are pre/post increment operators different?

What's the difference between ++a & a++?

6th Sep 2016, 7:50 PM
Shashidhar D
Shashidhar D - avatar
2 Answers
+ 5
in pre increment, first increase the value of variable by one then use it. in post increment, first use the value of variable then increase the value of variable by one. as an example, var pre, post, x, y; pre = 10; post = 10; x = ++pre; //x is 11 y = post++; //y is 10
6th Sep 2016, 7:59 PM
Celal Aybar
Celal Aybar - avatar
- 3
ejerkkfkrjrjvfirkrjfjfjgigjfjfjfjfjfjfjfjffjfjfjfjfjjfjf
7th Sep 2016, 5:20 AM
KJee Play
KJee Play - avatar