Chapter 25

Out, Bugs!

IN THIS CHAPTER

check Inserting code to help you debug

check Configuring a project for debugging

check Using Code::Blocks’ GNU debugger

check Stepping through a program

check Checking the values of variables

check Writing better error messages

Everyone writes buggy code. Not intentionally, of course. Even the best programmers get lazy or sloppy and do silly things. Stray semicolons, misplaced commas, and missing curly brackets happen to all programmers. Fortunately, the compiler catches a lot of this crummy code. Fix the source code and recompile to deal with those annoying, typical bugs.

For deeper problems, flaws in logic, or maybe code boo-boos that aren’t easy to find, it helps to have a little assistance. That assistance comes in the form of debugging your code, which you can do manually or with the help of a debugger. The goal is to see what’s gone wrong.

Simple Tricks to Resolve Problems ...

Get C Programming For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.