Increment variations

How to use increment? And what difference dose the position of the increment operator, ++ make? Ex:K=j++ and k=++j.

i = n++;
would set i to the original value of n i.e. 5 and would then increment n to 6. Whereas
i = ++n;
would increment n to 6 and then set i to 6.

http://www.macs.hw.ac.uk/~pjbk/pathways/cpp1/node65.html
Topic archived. No new replies allowed.