Increment Operator

Increment Operator

There are two types of Increment operator:
(1) Postfix Increment operator
(2) Prefix Increment operator


Postfix Increment operator(++)

It is use to increment value of variable one by one.

Syntax

variableName++

See Output

NOTE: In above program you have read b = a++;.In this statement value of a first assign to b then increment a.


See Output

In above program you have read c = a++ + b++;.In this statement value of a and value of b first add then result assign to c after assignment value of a and value of b will be increment.


See Output

In above program you have read printf("value of a = %d",a++);. In this statement first value of a will be display on output screen then value of a will be increment.


prefix increment operator(++)

It is also used to increment value of variable one by one.

Syntax

++variableName;

See Output

In above program you have read b = ++a;.In this statement value of a first increment then assign to b.


See Output

In above program you have read c = ++a + ++b;.In this statement value of a and value of b first increment then add. After addition result will be assign to c.


See Output

In above program you have read printf("value of a = %d",++a);. In this statement first value of a will be increment then display on output screen.


About Us

Comsysapp.com is an educational website. Students and software developers can learn programming language tutorials. Comsysapp is very useful for beginners and professional developers. Comsysapp provides tutorial in easy language. Comsysapp.com has focus on simplicity.

Services

Comsysapp.com provides free tutorials like c, html, css, etc. All tutorials are free for beginner and professionals.


Terms of Use

comsysapp.com is not responsible for any mistake. We are not responsible if information made available on our website is incomplete or invalid. But comsysapp.com always try for zero-zero mistake.

Privacy policy

comsysapp.com does not collect any data from users. We use Google AdSense advertising on our website. We never ask personal or private information.


Sitemap

sitemap

copyright © 2023