The operators that are used to add 1 to the value of a variable is called increment operator.
The increment operators (++)
The increment operator is represented by a value by a double plus (++) sign. It is used to add 1 to the value of an integer variable. This operator can be used before or after the variable name e.g.
xy = xy+1;
By using increment operator "++" it is written as xy ++;
The increment operator can be written either before or after the variable. If it is written before the variable, it is known as prefixing. If it is written after the variable, it is known as postfixing. Prefix and postfix operators have different effects when they are used in expressions.
Prefix Increment Operator:
When an increment operator is used in prefix mode in an expression, it adds 1 to the value of the variable before the value of the variable is used in the expression e.g.
Sum=a+ b + (++c) ;
Postfix Increment Operator:
When an increment operator is used in postfix mode in an expression, it adds 1 to the value of the variable after the value of the variable has been used in the expression.
Sum = a+b + c++;
The increment operators (++)
The increment operator is represented by a value by a double plus (++) sign. It is used to add 1 to the value of an integer variable. This operator can be used before or after the variable name e.g.
xy = xy+1;
By using increment operator "++" it is written as xy ++;
The increment operator can be written either before or after the variable. If it is written before the variable, it is known as prefixing. If it is written after the variable, it is known as postfixing. Prefix and postfix operators have different effects when they are used in expressions.
Prefix Increment Operator:
When an increment operator is used in prefix mode in an expression, it adds 1 to the value of the variable before the value of the variable is used in the expression e.g.
Sum=a+ b + (++c) ;
Postfix Increment Operator:
When an increment operator is used in postfix mode in an expression, it adds 1 to the value of the variable after the value of the variable has been used in the expression.
Sum = a+b + c++;