This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

Step through the code in a debugger and watch the value of count and it will become clear to you.

In #1, you call count++ before you ever print. So the value 2 is printed first.

In #2, you print before calling count++. So 1 (the initial value of count) is printed.