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


Please Help Members By Posting Answers For Below Questions

What is the difference between a template and a macro?

575


Is eclipse good for c++?

528


Explain how to initialize a const member data.

588


Is c better than c++?

598


What is the difference between equal to (==) and assignment operator (=)?

563






What is array in c++ example?

630


What is an accessor in c++?

604


What are compilers in c++?

594


what kind of projects are suitable for c and c++

609


What is the function of I/O library in C++ ?

652


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

552


What is the copy-and-swap idiom?

593


Can a Structure contain a Pointer to itself?

601


What do you mean by inheritance in c++?

585


How does work in c++?

579