Decrement operator

Decrement operator

There are two types of Decrement Operator:
(1) Postfix decrement operator
(2) Prefix decrement operator


Postfix Decrement operator(--)

It is use to decrement 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 assign to b then decrement 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 decrement.


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 decrement.


prefix decrement operator(--)

It is also used to decrement 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 decrement 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 decrement 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 decrement 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