
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
What does the operation c=a+++b mean in C/C++?
Let us consider in C or C++, there is a statement like:
c = a+++b;
Then what is the meaning of this line?
Well, Let the a and b are holding 2 and 5 respectively. this expression can be taken as two different types.
- c = (a++) + b
- c = a + (++b)
There are post increment operator, as well as pre increment operator. It depends on how they are used.
There are two basic concepts. The precedence and the associativity. Now if we check the expression from left to right, so the result will be these two.
- c = (a++) + b → 2 + 5 = 7
- c = a + (++b) → 2 + 6 = 8
Now let us check which option is taken by the compiler-
Example Code
#include <iostream> using namespace std; main() { int a = 2, b = 5; int c; c = a+++b; cout << "C is : " << c; }
Output
C is : 7
Here the first option is taken.
- Related Articles
- What does the explicit keyword mean in C++?
- What does the restrict keyword mean in C++?
- What does the volatile keyword mean in C++?
- What does “dereferencing” a pointer mean in C/C++?
- What does the [Flags] Enum Attribute mean in C#?
- What does int argc, char *argv[] mean in C/C++?
- What does the two question marks together (??) mean in C#?
- What does int argc, char *argv[] mean in C++?
- What does 'using namespace std' mean in C++?
- Does Ternary operation exist in MySQL just like C or C++?
- The ignition temperature of a fuel is 80°C". What does this mean?"
- What does it mean when a numeric constant in C/C++ is prefixed with a 0?
- What does geometry mean?
- What does psychology mean?
- What does humus mean?

Advertisements