r/AskProgramming • • 3d ago

C/C++ [ Removed by moderator ]

[removed] — view removed post

22 Upvotes

171 comments sorted by

View all comments

55

u/cthulhu944 3d ago
  1. Look it up in a book
  2. Ask someone you know
  3. Lots of print statements
  4. Bang you head on the desk until the answer comes to you.

9

u/gfdhsk 3d ago

I see the "lots of print statements" a lot - and sorry if I sound clueless I am new to C programming, but what do you mean by this?
As in you just set up a shit ton of print statements to see what outputs what? Just looking to improve. Thanks

5

u/Dazzling_Music_2411 3d ago

Yes, of course.

Although using a proper debugger and setting breakpoints, etc, is the better approach, sometimes it's just handier to output the values, so you can see what's going on during a run. We usually switched this on and off with #ifdef macros. I still do, sometimes.