You are not logged in. Please login at to post your questions!


If there is + or -sign in ahead of a variable, then what does it means??

For e.g. c+

asked 13 Jun, 23:18

mdrzwan12's gravatar image

accept rate: 0%

Do you mean expressions like c+=5; or c-=5; ?


answered 14 Jun, 00:20

vbt_95's gravatar image

accept rate: 22%

Yes. I meant that

(15 Jun, 08:45) mdrzwan120★

These are short-hand operations. If it's written that c+=(any expression) than that is equivalent to c=c+(expression). It works in a similar way for c-=exp as c=c-exp and other operators.

(15 Jun, 14:32) vbt_953★

ah, I see, I saw this question yesterday, and I thought you meant -5, or +5...I am stupid ok right, so usually there are these, for the positive signs first var++, ++var, var += 5 . first and second statement increments the variable by exactly one, meanwhile the thirdstatement increment the variable by how much value you put on the right of the += symbol, I put 5 so, the variable will be incremented by 5. E.g

int var = 2;
var++; //var becomes 3
++var; //var becomes 4
var += 5; //var becomes 9

now, after you have seen the example, you might be wondering, what's the difference between ++var and var++, this can be easily explained through a simple example E.g

int var = 2;
int lol = var++;

the pseudo-code above is the same as

int var = 2;
int lol = var;
var = var + 1;


int var = 2;
int lol = ++var;

which is the same as

int var = 2;
var = var + 1;
int lol = var;

which means, that var++, return the original value, and then increment, while ++var increment first and then return the value, as for

var += 1 or var += 2 or anynumber,

is the same as

var = var + 1
var = var + 2
var = var + anynumber

now that you understand the positive sign, the negative sign is the exact same, except it decrement


answered 15 Jun, 10:02

flaze07's gravatar image

accept rate: 23%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 13 Jun, 23:18

question was seen: 70 times

last updated: 15 Jun, 14:32