Describe faster ++i or i++, where i is an interger variable?, C/C++ Programming

A: The answer to this lies actually, how they used. Along ++i(PreIncrement) the variable is incremented and new value is returned. Thus it needs one instruction to increment the variable.

In case of i++(post Increment), the old value need to be returned or used in the expression and after that the variable is incrememented after the expression is evaluated. As you require one instruction to save the old value to be utilized in the expression and other instruction to increment the variable, its slower comparatively.

 

Posted Date: 3/21/2013 7:40:06 AM | Location : United States







Related Discussions:- Describe faster ++i or i++, where i is an interger variable?, Assignment Help, Ask Question on Describe faster ++i or i++, where i is an interger variable?, Get Answer, Expert's Help, Describe faster ++i or i++, where i is an interger variable? Discussions

Write discussion on Describe faster ++i or i++, where i is an interger variable?
Your posts are moderated
Related Questions
#question.conversion of tree into binary tree.

Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process wi

I Want a answer for solving the big M method in the topic of simplex method...

what is a variable

A PROGRAM TO CALCULATE AREA OF TRIANGLE

Define the Modulo Division Operator in c language? The C provides one more arithmetic operator % called as modulo division operator and this operator yields the remainder of an

Give practice in writing program''s..

Threaded binary tree: Consider the linked illustration of a binary tree 'T.  Approximately half of the entries is the pointer fields 'LEFT' and 'RIGHT' will have null elements. Th

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

Two kinds of line detection are implemented in OpenCV, the Hough Transform and the probabilistic Hough transform. Assume that there are n feature points in an image and that it tak