++n
- Is called a pre-increment operator because the operator appears to the left of its operand
- The pre-increment operator changes the value stored in memory first and then uses the new value in the remainder of the compound statement
- Here is an example (A-1):
n++
- Is called a post-increment operator because the operator appears to the right of its operand
- The post-increment operator uses the original value in the compound statement but still changes the value in memory when done
- Here is an example (A-1):
Example of (A-1)
int n = 0; cout << ++n << endl; // Displays a 1 cout << n++ << endl; // Displays a 1 cout << n << endl; // Displays a 2

Discussion
No comments for “Difference Between Pre Increment Operator and Post Increment Operator”