answersLogoWhite

0

For both cases, the ++ operator increments the integer by one. The difference lies in when it makes that increment. Take the following for example:

int B = 3

A = ++B

// A = 4, B = 4

---------------

int B = 3

A = B++

//A = 3, B = 4

In the prefix example, the increment occurs before the assignment. In the suffix example, the increment occurs after the assignment.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is the difference between prefix and postfix increment operator in c plus plus?

Both the prefix and the postfix increment operators increment the operand. The difference is what is the value of the expression during the evaluation of the expression. In the prefix form, the value is already incremented. In the postfix form, it is not. int a = 1; int b = ++a; // both a and b are now equal to 2 int a = 1; int b = a++; // a is equal to 2 and b is equal to 1


What is operand difference between operand and operator?

Simply defining, in an expression like A+B A is an Operand B is an Operand Plus is the Operator in between


How what operator is most efficient you plus plus or plus plus you?

Efficiency is the same; the difference is when the "++" is evaluated, before or after other operations. For example: a = b++ // This will first copy b to a, then increment b. a = ++b // This will first increment b, then copy it to a. If you have the "++" operator by itself, it makes no different if you use prefix or postfix. a++ is the same as ++a.


What is i plus 1 operator in C plus plus?

The increment operator in C++ is defined by operator++(). All arithmetic types (char, int, float, double, long, short, long long and long double) and all pointer types except void* are supported by operator++(). User-defined types can overload operator++() to provide support where required. operator++() has two versions, prefix increment and postfix increment. Prefix increment behaves as one would expect, incrementing the operand by 1 and returning the modified value. Postfix increment also increments the operand, however, the return value is the pre-incremented value. To understand the difference between prefix and postfix, consider the following: int i = 0; int j = ++i; // i=1, j=1 int i = 0; int j = i++; // i=1, j=0


What is the operator is used to allocate the memory in c plus plus?

calloc operator,malloc operator


What is the answer for 5 plus 3 plus 9 8 plus?

It is not possible to answer the question since there is no visible operator between 9 and 8.


What is the operator that cannot be overloaded in c plus plus and java?

conditional operator , size of operator , membership operator and scope resulation operator can not be overload in c++


What is the difference between private stafford and plus student loans?

What is the difference between private stafford and plus student loans?


What is 73 9?

Impossible to answer without the missing operator between the 73 and the 9. Please resubmit with the operator as a word, eg "What is 73 plus 9"?


What is the role of plus operator between two string constant?

The plus operator between string constants allows string concatination: string a = "Hello, "; string b = "World!"; string c = a + b; The output of c would be: "Hello, World!".


What is the difference between pointers in c and c plus plus?

Nothing.


What is the difference between be plus ing and get plus ing?

There are no such terms in C++.