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
Do you know about multiple inheritance?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What makes a language oop?
What is abstraction encapsulation?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
Can a destructor be called directly?
Whats oop mean?
Can enum be null?
how to get the oracle certification? send me the answer
Why do we need oop?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
class type to basic type conversion
What are benefits of oop?
What is use of overloading?
What is the difference between abstraction and polymorphism?