Increment and decrement operators are unaryoperators that add or subtract one from their operand, respectively. They are commonly implemented inimperativeprogramming languages. C-like languages became notorious for featuring two versions (pre- and post-) of each operator with slightly different semantics.
// Increment operators
x = 1;
y = ++x; // x is now 2, y is also 2
y = x++; // x is now 3, y is 2
// Decrement operators
x = 3;
y = x--; // x is now 2, y is 3
y = --x; // x is now 1, y is also 1
May 10th, 2014
Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.