Explain increment and decrement operators, C/C++ Programming

Increment and Decrement Operators.  

The operator for increment is '++' and decrement is '-'. These operators enhances or decrease the value of a variable on which they are operated, by one(1).  They can be used as prefix or postfix to the variable, and their meaning altersdepending on their usage. When used as prefix, the value of the variable is incremented/ decremented before using the expression. But when used as postfix, its value is first used and then the value is incremented or decremented.

e.g.

                --x;

                x--;

 

In the above example it does not matter whether the decrement operator is prefixed or suffixed. It will produce the similar result.

 

Posted Date: 6/27/2013 9:13:49 AM | Location : United States







Related Discussions:- Explain increment and decrement operators, Assignment Help, Ask Question on Explain increment and decrement operators, Get Answer, Expert's Help, Explain increment and decrement operators Discussions

Write discussion on Explain increment and decrement operators
Your posts are moderated
Related Questions
Op e r a t o r O v e r l o a d i n g : W h e n   a n   o p e r a t o r   i s   u s e d   f o r   d i ff e r e n t   op e r a

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Ask questionByteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

This is a test program that tests the Student and ITECH7603Class classes.     In this assignment you are provided with three input text files associated with this program:

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

char P[100]; double X=533.8*22500; sprintf(P,"%f %u",X,(unsigned int)X); MessageBox(P,"SSS"); //12010500.000 12010499

palindrome program with minimum character replacements

Explain the Working of strcpy Function? strcpy() : This function is meant to use to copy one string to another. The strcpy function as well accepts two strings as arguments.

Define Scope Rules of C program - Computer Programming? The fundamental rule of scope is that identifiers are accessible only within the block in which they are declared and th