printf-debugging

C Programming: seg faults, printf, and related quirks

As many young programmers do, I learned the usefulness of inserting numerous print-to-console statements of "here1," "here2," and so on at different points in code to figure out when my programs are going awry. This brute force debugging technique has saved me many, many times throughout my CS studies. However, when I started programming...

Educational example to show that sometimes printf as debugging may hide a bug

Hello all, I remember when I was in some course of C programming, a teacher once suggested to use printf to watch the execution of a program that I was trying to debug. This program had a segmentation fault with a cause that I cannot remember at the moment. I followed his advice and the segmentation fault disappeared. Fortunately, a cle...

How to "debug" Haskell with printfs ?

Hi there, coming from the Ocaml community, I'm trying to learn a bit of Haskell. The transition goes quite well but I'm a bit confused with debugging. I used to put (lots of) "printf" in my ocaml code, to inspect some intermediate values, or as flag to see where the computation exactly failed. Since printf is an IO action, do I have to...