Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You can increase a numeric variable's value by 1 using the increment operator: ++
- number++;
- You can decrease a numeric value by using the decrement operator: --
- number--;
- These are "Post" increment and decrement.
- 1. The value stored in nunber is modified
- 2. The old value is returned
- If we were to do:
- int number = 5;
- int otherNumber = number++;
- otherNumber would contain the value 5, number would contain the value 6.
- The pre-increment and pre-decrement value return the new number:
- int number = 5;
- int otherNumber = ++number;
- Now both variables will contain 6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement