top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How do you construct an increment statement or decrement statement in C?

+1 vote
1,024 views
How do you construct an increment statement or decrement statement in C?
posted Dec 2, 2014 by Vinitha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+1 vote

There are actually two ways you can do this. One is to use the increment operator ++ and decrement operator –. For example, the statement “x++” means to increment the value of x by 1. Likewise, the statement “x –” means to decrement the value of x by 1. Another way of writing increment statements is to use the conventional + plus sign or – minus sign. In the case of “x++”, another way to write it is “x = x +1″.

answer Dec 2, 2014 by Shivaranjini
0 votes

Lets take a variable
int A;
different ways to write :
A += 1;
A++;
A = A + 1;

answer Dec 2, 2014 by Bheemappa G
0 votes

Here is few example for the same.

int a;
a++; (post increment)
a--; (post decrement)
++a; (pre increment)
--a; (pre decrement)

answer Dec 2, 2014 by Chirag Gangdev
Similar Questions
0 votes

Which one will be faster in Java, Increment operator or Decrement operator?

a) for(int i = 0; i < 1000; i++) {}    
b) for(int i = 1000; i > 0; i--) {}
+2 votes

I'm a relative newbie to python, and this NG, but it's certainly growing on me.

One thing I'm missing is the increment/decrement operator from C, ie x++, and its ilk. Likewise x += y.

Is there any way of doing this in Python?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...