h Home

Debugging c programs:

Debugging using User-space tools

Debugging using kernel tools

Printf debugging

One of the oldest methods of debugging is "printf debugging" - putting various print statements in the code and then staring at the output.
The information output may just be a short string to indicate that a particular point in the code has been reached or it might be a complete stack trace.

When do we use printf debugging


It is useful when you can't use a debugger. If the program does not crash, but produces wrong results after long computation, it's hard to figure where exactly the problem lies. In that case, printing intermediate data can be a very efficient method.

disadvantages


• Sometimes you need a lot of printf()'s, and it can get    tedious putting them in and taking them out.
• In printf debugging, after adding print statements the    program must be recompiled
• we can't use it on a running process


      We provide printf Debugging-Free Online tutorials for the educational purposes only. We do not responsiable for the correctness of its contents. the risk of using it lies entirelywith the user.