Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Which is faster post increment or pre increment ? and in
which cases should u use either - to increase speed?

Answer Posted / me

In normal cases where we use x++ or ++x for integer
variables in loops etc, both behave the same.

However, when we have classes that overload the ++
operator, it's faster to use the ++x rather than x++.

This is because when we do x++, a temporary object is
created to point to the original value, then the value is
incremented, and the pointer is updated and returned.

in case of ++x, just the value is incremented and pointer
to itself is returned. therefore ++x is faster in this case.

Is This Answer Correct ?    31 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is abstract thinking intelligence?

1054


What is the types of inheritance?

1098


What is the difference between a mixin and inheritance?

992


Whats is abstraction in oops?

1083


What is the main purpose of inheritance law?

1199


• What are the desirable attributes for memory managment?

2236


What is inheritance write a program to show use of inheritance?

1149


Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

4151


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6680


Plese get me a perfect C++ program for railway/airway reservation with all details.

3909


What is the point of polymorphism?

1035


Why multiple inheritance is not possible?

1074


What is variable example?

1045


What type of loop is a for loop?

1091


write knight tour problem which is present in datastructure

2655