what is ++ in c++
......
Share
what is ++ in c++
......
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
Explanation:
in C++; ++ is a unary operator that can be applied to variables and increments the value they hold. For example often for loops have, as their increment-expr something like:-
counter++
Like all other C++ operators, ++ returns a value:-
If ++ precedes the variable, e.g. ++counter, the value returned is the value in counter after it has been incremented.
If ++ follows the variable, e.g. counter++, the value returned is the value in counter before it has been incremented.
This allows some C++ pedants to say that C++ is wrong, as it implies the enhanced value isn't used, and that it should be called ++C.