Table of Contents
The increment operator ++ increases the value of an operand by 1. It can be used as a prefix or postfix operator.
#include <stdio.h>
int main()
{
int number = 5;
number++;
printf("number = %d\n", number);
return 0;
}
Example Output #
number = 6
Explanation #
The increment operator is applied to number:
number++;
This increases its value from 5 to 6.
The increment operator can be written in two forms:
++number;
number++;
Both forms increase the operand by 1. The difference between prefix and postfix forms becomes relevant when the increment operation is part of a larger expression.