Home

The 10 Most Common C++ Mistakes

|
|  Updated:  
2016-03-26 22:09:24
C++ For Dummies
Explore Book
Buy On Amazon

Although many C++ programmers take measures to prevent bugs, mistakes still slip through. This list of the ten most common mistakes while writing C++ code can help both new and veteran programmers:

  1. You forgot to declare the variable.

  2. You used the wrong uppercase and lowercase letters; for example, you typed Main when you meant main.

  3. You used one equal sign (=) when you were supposed to use two (==), either in an if statement or in a for loop.

  4. You forgot #include or using namespace std;.

  5. You dropped the laptop in the swimming pool.

  6. You forgot to call new and just started using the pointer anyway.

  7. You forgot the word public: in your classes so everything turned up private.

  8. You let the dog eat the remote.

  9. You forgot to type the parentheses when calling a function that takes no parameters.

  10. You forgot a semicolon, probably at the end of a class declaration.

About This Article

This article is from the book: 

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.

Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.