Quote:
|
Originally Posted by TubaMorg
i++ is shorthand for i = i + 1 since incrementing by one is such a common task in programming. Similarly i-- is the same as i = i -1. If you want to add or subtract something different then you have to use the long version as in i = i + 3.
Not many people realize you can also go ++i and --i which is subtly different. In most cases the end effect is the same but not always. With ++i (prefixed) the value is computed before the expression is evaluated. The postfix version i++ is the opposite where the value is computed AFTER the expression is evaluated. This doesn't make any difference if you just go:
i++;
or
++i;
However if you try:
m = ((++i)*(j++)/5;
i will increment by 1 BEFORE the rest of the expression is evaluated. j will be incremented AFTER the expression is evaluated.
Good luck!
|
Awesome.. thanxs for the tip


more for my programming knowledge
