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

Assignment Help:

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.

 


Related Discussions:- Explain increment and decrement operators

Recursion, write a cprogram to calculate fraction through recursion

write a cprogram to calculate fraction through recursion

Expression, i need expression and its types with example programs in c++

i need expression and its types with example programs in c++

Memory management operator, Memory Management Operator In C malloc( ), ...

Memory Management Operator In C malloc( ), calloc( ), realloc( ), and free( ) are used to mange dynamic memory.  In addition to these function C++ have derived two unary ope

Creating shopping carts, how to create a shopping cart and sibmit the code ...

how to create a shopping cart and sibmit the code segment on screan

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

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

C program for sorting of long word with one string, C Program for SORTING O...

C Program for SORTING OF LONG WORD WITH ONE STRING #include stdio.h> #include conio.h> #include string.h> void main() {           char n[50],c[25][25];

What is some instance of operator overloading?, A: Here are a few of the ma...

A: Here are a few of the many instance of operator overloading: myString + yourString may concatenate two std::string objects myDate++ may increment a Date object a * b may m

Functions overloading, Functions Overloading This a capability in which...

Functions Overloading This a capability in which a C++ program can have several functions performing similar tasks on different data types. When an overloaded function is calle

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd