title: How do you debug a C program on Windows?
body: <p>I've never used a debugger and the time has come to give them a try. MinGW appears to come with GDB which I've been trying to use. Supposdly running gdb from the command line and typing <code>run myprog.exe</code> starts the debugger but when I do this I get </p>
  
  <p>Starting program: C:\MinGW\bin\myprog.exe MyProg.exe
  [New Thread 1828.0xd8c]
  Error opening file.
  [Inferior 1 (process 1828) exited with code 02]</p>
  
  <p>How to proceed or what's an easier way?</p>
  
  <p><strong>In particular I'm trying to flush out undefined behavior.</strong></p>