0 votes
in C Plus Plus by
What is difference between i++ and ++i?

1 Answer

0 votes
by

The expression ‘i++’ returns the old value and then increments i. The expression ++i increments the value and returns new value. 
2) Precedence of postfix ++ is higher than that of prefix ++. 
3) Associativity of postfix ++ is left to right and associativity of prefix ++ is right to left. 
4) In C++, ++i can be used as l-value, but i++ cannot be. In C, they both cannot be used as l-value

...