You have been debugging through sprinkling printf() statements to debug your source codes. This is ok when the program is simple, but it become too time consuming.
When you are writing the source code, you have certain belief that how variables are changing, and how the process is moving. But it would be nice if there is a quicker way of confirming the process than putting printf(), wouldn't it?
Debugger is a very useful tool to proof your belief. It will let you execute statement by statement, and let you see how variables are changing.
We'll learn how to use Data Display Debugger (DDD). It is a front-end to an actual debugger (GNU debugger, gdb). In other words, you can use gdb through the graphic user interface of ddd. More advanced people may prefer using gdb directly (or emacs as the front end), but I frequently find that ddd is useful and easy to use.