INCREMENT AND DECREMENT IN C

Maha

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
-- 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;
}

Output:

10
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;
}

Output:

10
9
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send