Difference Between i++ and ++i
i++ V/S ++i :
i++ | ++i |
1 . Post fix operator. | 1 . Prefix operator. |
2 . It assigns value to the variable on left and increments the operand. | 2 . It first adds one(1) to the operand and then the result is assigned to the variable on left. |
3 . i = 5; y = i++; The value of y would be 5 and I would be 6. | 3 . i = 5; y = ++i; The value of and I would be 6. |
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment