You are here

General Discussion

19 January, 2016 - 11:41

The idea of increment or decrement is to either add or subtract 1 from a variable that is usually acting as a fag. Using a variable named counter; in generic terms, for example:

increment the counter The concept is: counter is assigned counter + l 

That is you fetch the existing value of the counter and add one then store the answer back into the variable counter. Many programming languages allow their increment and decrement operators to only be used with the integer data type. Programmers will sometimes use inc and dec as abbreviations for increment and decrement respectively.

Operator symbols and/or names vary with different programming languages. The C++ programming language operators with their meanings are:

Table 14.1 C++ Operators and their meanings

C++ Operator



increment, two plus signs


decrement, two minus signs