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
where to use tower of honoi?

1.1 A Few Notes: 1. Please test your program with various inputs prior to submission. 2. All group members must understand the entire project for interactive grading. Equal

Program is to store marks and name, roll no in a file: class stud   {     int rno;     char name[20];     int m1,m2,m3;     public:                 void acce

Description A long time ago in a galaxy far, far away, the country Mafghanistan had n cities and m old roads, where each road connected a pair of cities. Due to the treacherous mo

A: Multiple providers of libraries might employ common global identifiers causing a name collision whereas an application attempt to link with two or more such libraries. The names

give an example of function

Implement multiple stacks in a single dimensional array using c.

#Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.   #include float start_poi

Write a function that takes an array as the argument and returns the second largest element. Bonus (+5): Write a function that takes an array and a number n as arguments and return

Overloading Binary Operators class SI {float i,p,n,r,a; public: SI(){}; SI(int gp,int gn, int gr); void putdata(void); SI operator+(SI); }; SI SI::opera