3 ms·
Printf doesn't really require you to reason about the code anymore than stepping through the code does. Usually you already know where it crashes. You can rando
by chrismcb 3y ago
Printf doesn't really require you to reason about the code anymore than stepping through the code does.
Usually you already know where it crashes. You can randomly put a printf somewhere but the value may have changed somewhere else. If you are paying attention stepping through the code let's you see when the value changes. As opposed to adding a print, running, adding another print, running, etc.
I would also argue stepping through code let's you understand the code better than a simple print. As you can see things happening in realtime.
Both methods have their usefulness, both are just tools you should have in your toolbox.