When programming, you will definitely run into situations, where you code something with the only purpose to help you debug. You probably don't want those functions in the released program. A simple way to do this, is to wrap them in a macro, which gets defined to nothing, if you didn't set the compiler flag for debug-mode (e.g -DDEBUG).

Another feature from the preproccessor you can use for debugging is the compile time information. With __FILE__ you get the filename and with __LINE__ the line number. With that you can augment your debugging prints to include information about the file and line.

Define the debug() macro, that behaves like printf but only actually prints when the variable '-DDEBUG' is set.