Pre-Increment : y = ++ivar Steps :
- Value of ivar is incremented
- Then value of ivar is assigned to y
In Short :
- When Prefix (++/–) is used with a variable in an Expression .
- The variable is incremented/decremented by one then Expression is evaluated using the original value of variable
- Here a is incremented /decremented before use
Live Example :
#include<stdio.h>void main(){int a,b,x=10,y=10;a = x++;b = ++y; // Pre-Incrementedprintf("Value of a : %d",a);printf("Value of b : %d",b);}Output :
Value of a : 10Value of b : 11
Why Output is 11 in case of Pre-increment :
- Pre (before) , Value of y is first incremented i.e y = 11
- Then y is assigned to b

