Increment operator in C by R4R Team

Increament operator :

-Denoted by ++
-this operator are able to increase the variable value by 1

Types:
post increament(i++)
pre increament(++i)

Example-
i=3;
i++;
//Now value of i is 4
++i;
//Now value of i is 5


program-

#include < stdio.h>
int main()
{
int i=0;
printf("i=%dn",i);
i++; // i=i+1
printf("i=%dn",i);
++i;
++i;
i++;
printf("i=%d",i);
}


output-

i=0
i=1
i=4

-In this program, we start with i=10, then print the value of i after apply increament operator and result will show in above output.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!