Need a very quick clarification on post-incrementors


I just need to clarify something that will be on one of my tests that is seemingly very simple. Assuming,

int a = 2, b = 5, c = 0;

I know that the following will evaluate to 12, because the pre-incrementor took effect before the operation.

c = a * ++b;

Why does the following evaluate to 10 if you output c on the next line? Maybe I'm missing something, but it should evaluate to 10 if you were to take the value of that particular line, but shouldn't the post-incrementor take effect after the operation is complete?

c = a * b++;

c = 2 * 5++
c = 10++ // Value on this line is 10
cout << c; // Value on next line is 11

Thanks.
Given

a = 2,
b = 5, and
c = 0,

after

c = a * b++;

these become

a = 2,
b = 6, and
c = 10.
Topic archived. No new replies allowed.