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 is the difference between a template and a macro?
Is eclipse good for c++?
Explain how to initialize a const member data.
Is c better than c++?
What is the difference between equal to (==) and assignment operator (=)?
What is array in c++ example?
What is an accessor in c++?
What are compilers in c++?
what kind of projects are suitable for c and c++
What is the function of I/O library in C++ ?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
What is the copy-and-swap idiom?
Can a Structure contain a Pointer to itself?
What do you mean by inheritance in c++?
How does work in c++?