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




More topic in C

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

GocourseAI

close
send