Why preincrement operator is faster than postincrement?
Answer Posted / puneet nagpal
postincrement did not increment unless it find ; so it increments after the end of statement. while the preincrement operator increment before the end of statement. so preincrement operator is faster than postincrement operator.
ex- a=10;
a++;value incremented after the end of statement but
at this point value is 10.
a++;now the value is incremented to 11.
++a; preincrement incremented within the statement now
the value is 12.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What type of question are asked in GE code writing test based on c++ data structures and pointers?
What is data type in c++?
How a new operator differs from the operator new?
What is the difference between public and private data members?
Difference between a homogeneous and a heterogeneous container
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
What is the difference between #import and #include in c++?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
How should runtime errors be handled in c++?
List different attributes in C++?
What is an orthogonal base class in c++?
What are the benefits of c++?
What is the difference between cin.read() and cin.getline()?
What are multiple inheritances (virtual inheritance)?
Why is it necessary to use a reference in the argument to the copy constructor?