Increment And Decrement In C
In C program, that includes the increment (++) and decrement (--)
operators are used to increase the value or decrease the value of a
variable by 1, respectively.
Increment And Decrement Operators Are:
++ Increment
Example For Increment Operator:
-- Decrement
Example For Increment Operator:
Program:
#include<stdio.h>
int main() {
int a = 10;
printf("%d\n", a);
a++;
printf("%d\n",a);
return 0; }
int main() {
int a = 10;
printf("%d\n", a);
a++;
printf("%d\n",a);
return 0; }
Output:
10
11
11
Example For Decrement Operator:
Program:
#include<stdio.h>
int main() {
int a = 10;
printf("%d\n", a);
a--; printf("%d\n",a);
return 0;a--; printf("%d\n",a);
}
Output:
10
9
9
More topic in C