1/24/00
COM1100 Winter2000 Lecture 7
30
Summary -- increment and decrement operators
nFour possibilities
n
n
n
n
nAuto increment/decrement most useful with subscripts, pointers and loop counters
nMay be used in expressions
nOften used in stand-alone
nZ = I * I;
n ++I;
use old value of x, the decrement x
x--
decrement x, the use new value
--x
use old value of x, the increment x
x++
increment x, the use new value
++x