Pre-Increment : y = ++ivar Steps :
- Value of ivar is incremented
- Then value of ivar is assigned to y
- 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
Output :#include<stdio.h> void main() { int a,b,x=10,y=10; a = x++; b = ++y; // Pre-Incremented printf("Value of a : %d",a); printf("Value of b : %d",b); }
Value of a : 10 Value of b : 11Why 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

0 comments
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email