| GNU C++ Compiler
|
Debugging: Run-time Errors
|
Mistakes the compiler doesn't catch (the hardest problems to solve sometimes)
cin/cout
outputs wrong number of items or just
completely skips some
- Check that you have arrows, not commas, between every 2
items (variables, strings, function calls, etc., all count as
separate items.
- Loop or decision statement doesn't work
- Check for semicolons at the end of a loop or decisiont statement.
They don't belong there (
if, do, while, for
, etc.
do not take a semicolon at the end of the line)!
switch/case
statement 'bleeds' from one case to
the next
- There must be a
break;
at the end of every case
in a switch()
block.
- Wrong answer to a seemingly correct formula
- Remember operator precedence! Start by adding lots of
parentheses--it can't hurt to have a lot of them! This
is especially important in complex formulas where the
precedence may be obvious to you, but not to the
compiler.
Mail me your suggestions!
Back to Debugging Page
Back to GNU C++ Compiler Home Page
Back to my Home Page
Andrews University's Home Page