title: Variable is treated as uninitialized
body: <p>In the C code below (that is inspired by an example in K&amp;R), the variable <code>nw</code> is treated as uninitialized:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define IN 1
  #define OUT 0
  main(){
  
      int c,nl,nw,nc = 0;
      int state = OUT;
      while((c=getchar())!=EOF){
          ++nc;
          if(c=='\n')
              ++nl;
          if(c==' ' || c=='\n' || c=='\t')
              state = OUT;
          else if(state == OUT){
              state = IN;
              ++nw;
          }
      }
  
      printf( "%d %d %d\n" , nl, nw, nc);
  }
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>input: one two three
  output: 1 796411731 14
  </code></pre>
  
  <p>The middle figure should have been 3 (<code>nw</code> = number of words) </p>
  
  <p>I don't understand why this happens, given that I explicitly assign a value to it in the beginning. </p>