C Tutorial Unary increment operators
Introduction to C language
Integer types
Char constants
Int constants
Type combination and promotion
Int overflow
Floating point types
Comments
Variables
Assignment operator
Truncation
Int vs float arithmatic
Mathematical operators
Unary Increment Operators
Pre and Post Variations
C Programming Cleverness and Ego Issues
Relational Operators
Logical Operators
Bitwise Operators
Other Assignment Operators

 

 
 
 
 

 

HOME
 

The unary ++ and -- operators increment or decrement the value in a variable. There are

"pre" and "post" variants for both operators which do slightly different things (explained

below)

 

var++

increment

"post" variant

++var

increment

"pre" variant

 

var--

decrement

"post" variant

--var

decrement

"pre" variant

 

int i = 42;

i++;     // increment on i

// i is now 43

i--;     // decrement on i

// i is now 42

Want more information and

 

 Video ???