Increment and Decrement Operators

In this lesson, you will learn about ++, -- operators and what happens when you use them as the prefix or postfix operators.

You may come across two unusual-looking operators that may be used as a shorthand for incrementing and decrementing variables. The ++ and -- operators add 1 and subtract 1, respectively, from their operands. For example in the following code snippet, we increment the int variable a and we decrement the int variable b:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy