+ 1
How are pre/post increment operators different?
What's the difference between ++a & a++?
2 Respostas
+ 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
- 3
ejerkkfkrjrjvfirkrjfjfjgigjfjfjfjfjfjfjfjffjfjfjfjfjjfjf