Pre-Increment Operator
If the ++ is before the variable then the incrementing is done first.
int amount, count;
count = 3;
amount = 2 * ++count;
1 gets added to count first, then amount gets the value of 2 * 4 or 8
So after executing the last line, amount is 8 and count is 4.
Previous slide
Next slide
Back to first slide
View graphic version