Can someone please explain to me the difference between ++i and i++ when written as part of an expression (i.e. within loops and if statements) ? Thanks
Could I suggest a book?: C++ Primer 3rd Edition
Covers tiny stuff like performance details and the new C++ standard very well,bit advanced but very good if you want details.
Postfix(p++) and Perfix(++p).
Rules
p++ - First
use value then increment.
++p - First
increment then use value.
If you still dint understand after all the stuff the other guys gave.Then check this out.
You are mad at a guy, he shouts at you,making you madder.With p++ you shout at the guy then slap him and with ++p you slap him first, then shout at him.
The end result is that on the first case he would have got a piece of your mind before getting the physical part for what ever he did, and the other way around with the second.
Which method you want to use depends on the situation and your choice.
(Hint: p++, if you plan on running)

,no offense anyone.
Also,val++ (real c++ here ok) is what is commonly used by many programmers.
As far as loops go it depends on which type of loop you re going to use like
for(), while() , and do while() ,where it's declared and where the expression is placed.Just apply the rules and you will have the result.