Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Printf debugging

  1. Jun 19, 2006 #1
    Hi there,

    I'm noob at programming. Can anyone explain me why we need printf debugging, how to implement it, and for what is used it?

    Thank you
  2. jcsd
  3. Jun 19, 2006 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    "Printf debugging" is a rather dumb term to describe placing print statements throughout your code, often printing the value of important intermediate calculations, so that you can observe the program's internal behavior.

    - Warren
  4. Jun 26, 2006 #3

    jim mcnamara

    User Avatar

    Staff: Mentor

    "instrumentation" may a better, more all-inclusive term.
  5. Jul 14, 2006 #4
    Instrumentation is normally used in situations where you can't get at the code with a debugger but you have accesses to some kind of serial interface to a terminal. Then the printf statements send messages to the terminal. You just enter the printf statements in the code, compile and then look at the results. Enter more printfs, compile and look at the results. It is a SLOW way to debug.

    In most cases, it is easier to simply use an inexpensive debugger and look at the code directly. You can get a Visual Basic or Visual C++ debugger for around $100 these days.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook