title: segmentation fault in getword
body: <p>Hi this is a question regarding the Kernighan and Ritchie keyword count program (Chapter 6 section 3 of the ANSI edition). I've included the entire code in the link below.</p>
  
  <p>When I try to run the code on any C source code I don't get any output. So in an attempt to pinpoint the problem, I've printed statements at different points in the code. The output of the program (when applied on itself) in the terminal window looks like this now:</p>
  
  <pre><code>./a.out &lt; keywords.c
  I've got past the beginning of the getword loop.
  I've got past the beginning of the getword loop.
  I'm past the word[0] condition.
  Segmentation fault
  </code></pre>
  
  <p>When I use another search method (linear search through a struct key array)I get another combination of the same output, this time without the segmentation fault. Going by the output from the printf statements, I'm inclined to think that there's something wrong with the getword function. So what's causing these errors?</p>
  
  <p>The following is the entire code with both binary and linear search functions:</p>
  
  <p><a href="http://pastebin.com/sPEYYge6" rel="nofollow">http://pastebin.com/sPEYYge6</a></p>