c / beginner
Snippet
Increment and Decrement Operators
The increment (++) and decrement (--) operators provide a shorthand for adding or subtracting 1 from a variable. They are commonly used in loops and counters.
snippet.c
1
2
3
4
int count = 10;count++;count--;count--;
Breakdown
1
count++;
Increases the value of count by 1 (shorthand for count = count + 1).
2
count--;
Decreases the value of count by 1 (shorthand for count = count - 1).