Printf debugging

  • Thread starter chmate
  • Start date
  • #1
37
0
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
 

Answers and Replies

  • #2
chroot
Staff Emeritus
Science Advisor
Gold Member
10,226
34
"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
 
  • #3
jim mcnamara
Mentor
4,018
2,455
"instrumentation" may a better, more all-inclusive term.
 
  • #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.
 

Related Threads on Printf debugging

  • Last Post
Replies
10
Views
1K
  • Last Post
Replies
1
Views
574
Replies
4
Views
2K
  • Last Post
2
Replies
31
Views
2K
  • Last Post
2
Replies
32
Views
263
  • Last Post
Replies
5
Views
3K
Replies
2
Views
2K
  • Last Post
Replies
13
Views
4K
Replies
4
Views
2K
  • Last Post
Replies
3
Views
861
Top