Click here to Skip to main content
12,633,764 members (26,702 online)
Click here to Skip to main content
Articles » Languages » C / C++ Language » General » Alternatives
Alternatives
Add your own
alternative version

Tagged as

Stats

9K views
1 bookmarked
Posted

Increment/Decrement operators

, 2 Mar 2010 CPOL
When incrementing or decrementing a variable, favor prefix operators over postfix operators if you do not need the value of the expression.Example:void foo(std::vector intvec){ for (std::vector::iterator it = intvec.begin(); it != intvec.end(); ++it) { // do something ...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

No alternatives have been posted.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Stefan_Lang
Software Developer (Senior)
Switzerland Switzerland
Graduated at TU Darmstadt in Math & CS, with a heavy focus on CAD/CAM

Programming and designing applications in C++ in the areas AI, real-time programming, client-server applications and CAD/CAM since 1985.

Personal interests: AI, computer graphics, games, reading

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 2 Mar 2010
Article Copyright 2010 by Stefan_Lang
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid