Are there real world applications where the use of prefix versus postfix operators matters?
- by Kenneth
In college it is taught how you can do math problems which use the ++ or -- operators on some variable referenced in the equation such that the result of the equation would yield different results if you switched the operator from postfix to prefix or vice versa. Are there any real world applications of using postfix or prefix operator where it makes a difference as to which you use? It doesn't seem to me (maybe I just don't have enough experience yet in programming) that there really is much use to having the different operators if it only applies in math equations.
EDIT: Suggestions so far include:
function calls //f(++x) != f(x++)
loop comparison //while (++i < MAX) != while (i++ < MAX)