ali.cooom Posted July 9, 2013 Posted July 9, 2013 can someone explain to me the outputs please? i don't understand how the increment and decrement operator work in these situations. thanks
EdEarl Posted July 9, 2013 Posted July 9, 2013 i=1; x=++i; /* x=2 because increment before the value of i is assigned to x */ x=i++; /* x=2 because increment after the value of i is assigned to x */ ++i increment before value of i used in expression preincrement i++ increment after value of i used in expression postincrement
pwagen Posted July 10, 2013 Posted July 10, 2013 Look at the difference in the output in the last example. Why is that different from the others?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now