Posted by Andy on December 18, 2001 at 19:58:58:
In Reply to: Re: Prefix/Postfix increment operators posted by Missy on December 18, 2001 at 18:33:03:
: : How come the Postfix returns Count-1? Got this question from Operators 11; page 93. Thanks for the help.
: From my understanding, if you have
: y = 5;
: y = x++;
: The assignment of x to y is done first.
: Then x is incremented.
: so after:
: y = 5;
: y = x++;
: y would equal 5 and x would equal 6.
: For the correct values to be held, count (the value of x) must be incremented, but since it is postfix Count-1 must be return for y to be correct.
: Hope that makes sense.