+ 4
What is pre increment and post increment?
3 Answers
+ 3
Let int x=5
Pre increment:(++x) :: First increases the value of x by 1 and then uses new value .
Post increment:(x++)::First uses the value of x(i.e. 5) and then increases the value by 1 .
+ 3
pre increment:
int a = 5
int b = ++a
a and b will be equals 6 because a is incremented before assignment.
post increment:
int a = 5
int b = a++
b will be equals 5 whilst a is equals 6 because a is incremented after assignment.