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

C program for sorting, C Program for SORTING # include stdio.h> void...

C Program for SORTING # include stdio.h> void main() {           char a;           int *p;           int i,j,temp;           clrscr();           p=&i;

What are the benefits of using friend classes, What are the benefits of usi...

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

However shouldn''t i always use a printon() method instead , Q: however sho...

Q: however shouldn't I always use a printOn() method instead of a friend function? A: No. The usual cause people wish to always use a printOn() method instead of  a friend fu

Calculate the discharge by c program, #include stdio.h #include math.h ...

#include stdio.h #include math.h float discharge(float,float); void main()   {   char prompt;      float time,out,cr;   cr = 100e-6;   for (time = 0;time   {   /* call th

Explain enumerated constants, Enumerated Constants Enumerated constants...

Enumerated Constants Enumerated constants enable the creation of new types and then explain variables of these types so that their values are restricted to a set of possible va

Molecular dynamics and Monte carlo, Molecular dynamics for a Lennard-Jones ...

Molecular dynamics for a Lennard-Jones system (in C++) 1. Write a function which reads in the input variables of a molecular dynamics simulation of a Lennard-Jones system. The inpu

Net salary, please may i have a brief theory about a c++ program to find ne...

please may i have a brief theory about a c++ program to find net salary of employees

Explain nested classes, Nested Classes Many a times, it becomes essenti...

Nested Classes Many a times, it becomes essential to have a class contain properties of two other classes. One way is to explain a class within another - that is a class with m

Destructor on a local variable, Should I explicitly call a destructor on a ...

Should I explicitly call a destructor on a local variable? Explain it.

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