IT Community - Software Programming, Web Development and Technical Support

Why is preincrement operator is faster than postincrement?

This is a discussion on Why is preincrement operator is faster than postincrement? within the C and C++ Programming forums, part of the Software Development category; Hi, can u anyone give real example of above questions. Thanks, prasath.K...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-17-2007, 05:34 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Default Why is preincrement operator is faster than postincrement?

Hi,
can u anyone give real example of above questions.


Thanks,
prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-30-2007, 06:43 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: Why is preincrement operator is faster than postincrement?

Hi prasath,

The concept of "passing by reference" itself is alien to C.
And the post/pre-increment are not functions, they are operators. So, both of them have to increment whatever value is sent to them.
If you understand the concept of passing by value, you will know that the value of the variable sent to the function will remain unchanged.
As you are thinking if post increment passes the argument as "pass by value", then the value should not change at all. But, on the contrary, it also changes the value of the argument!

Hope informative to you.
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Faster Database Oracle vs Mysql vivekanandan Database Support 1 09-04-2007 04:10 AM
Why preincrement operator is faster than postincrement? Sabari C and C++ Programming 1 07-24-2007 04:42 AM
Which is faster for array, while or for or foreach ? vivekanandan PHP Programming 1 07-20-2007 07:15 AM
A Faster Wi-Fi World Is Coming vigneshgets The Lounge 0 05-29-2007 06:16 AM
Making Code Faster pranky C and C++ Programming 1 03-02-2007 12:17 AM


All times are GMT -7. The time now is 04:49 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0