title: Linux, C, ncurses: seg fault caused by printw
body: <p>Is there any reason why <code>printw()</code> would cause a segmentation fault?</p>
  
  <p>Code is fine without it; broken with it.  It doesn't seem to be doing anything esoteric, so I'm not sure how to even begin to understand what is wrong here.</p>
  
  <p>Thanks in advance for any advice!</p>
  
  <pre><code>#include &lt;ncurses.h&gt;
  ...
  initscr();
  noecho();
  cbreak();
  ...
      void draw_court()
      {
          move(TOP_ROW-1, LEFT_COL+4);
          printw("LIVES REMAINING: 3");
  
          int i;
          for (i = 0; i &lt; RIGHT_COL; i++)
              mvaddch(TOP_ROW, LEFT_COL+i, H_LINE);
  
          for (i = 1; i &lt; BOT_ROW-TOP_ROW; i++)
              mvaddch(TOP_ROW+i, LEFT_COL, V_LINE);
  
          for (i = 0; i &lt; RIGHT_COL; i++)
              mvaddch(BOT_ROW, LEFT_COL+i, H_LINE);
      }
  </code></pre>
  
  <p>ETA: The stacktrace from gdb:</p>
  
  <pre><code>#0 0xb778a139 in _nc_printf_string () from /lib/libncurses.so.5
  #1 0xb7785e04 in vwprintw () from /lib/libncurses.so.5
  #2 0xb7785f63 in printw () from /lib/libncruses.so.5
  #3 0x08048f23 in draw_court ()
  #4 0x080489f4 in set_up ()
  #5 0x0804890a in main ()
  </code></pre>