title: Why does arr[1] print what appears to be arr[0]?
body: <p><em>The program below is from 'The C Answer Book', Exercise 1-13. This is for comprehension &amp; self-study.</em></p>
  
  <hr>
  
  <p><em>I set the stage for my question below:</em></p>
  
  <hr>
  
  <pre><code>#define MAXWORD 11
  </code></pre>
  
  <hr>
  
  <p>Elements of array wl[ ] are initialized to zero.</p>
  
  <pre><code>/* INITIALIZE WORD LENGTH COUNTER */
  for (i = 0; i &lt; MAXWORD; ++i) {
      wl[i] = 0;
  }
  </code></pre>
  
  <p>If word sizes are greater than zero and less than the maximum, store them in the array.</p>
  
  <pre><code>if (nc &gt; 0) {
      /* INCREMENT WORD LENGTH COUNTER */
      if (nc &lt; MAXWORD) {
          ++wl[nc];
      }
      ...
  }
  </code></pre>
  
  <p><strong>The loop below starts with i = 1. Why does wl[1] print what appears to be wl[0]?</strong></p>
  
  <pre><code>/* PRINT COUNTER HEADER */
  for (i = i; i &lt; MAXWORD; ++i) {
      printf("%5d - %5d : ", i, wl[i]);
      ...
  }
  </code></pre>
  
  <hr>
  
  <p><strong>¡EXTRA CREDIT!</strong></p>
  
  <p><strong>Please teach me how I could have found your answer by myself.</strong></p>
  
  <hr>
  
  <p>Output when i = 0</p>
  
  <pre><code> 0 -     0 : 
   1 -   111 : ************
   2 -   129 : ***************
   3 -    31 : ***
   4 -    42 : ****
   5 -    32 : ***
   6 -    24 : **
   7 -    24 : **
   8 -    13 : *
   9 -    17 : *
  10 -     6 : *
  There are 9 words &gt;= 11
  </code></pre>
  
  <hr>
  
  <p>Output when i = 1</p>
  
  <pre><code> 1 -   111 : ************
   2 -   129 : ***************
   3 -    31 : ***
   4 -    42 : ****
   5 -    32 : ***
   6 -    24 : **
   7 -    24 : **
   8 -    13 : *
   9 -    17 : *
  10 -     6 : *
  There are 9 words &gt;= 11
  </code></pre>
  
  <hr>
  
  <p>COMPLETE SOURCE CODE:</p>
  
  <pre><code>/* Write a program to print a histogram of the lengths of words in
   * its input. It is easy to draw the histogram with the bars horizontal; a vertical
   * orientation is more challenging. 
   *
   *  1   |   ***
   *  2   |   ****
   *  3   |   ******
   *  4   |   *********
   *  5   |   **
   *  X   |   **********
   *  
   *  There were 7 words greater than 11 character.
   *  --------------------------------------------- */
  
  #include &lt;stdio.h&gt;
  
  #define MAXHIST 15                                  /* max length of histogram */
  #define MAXWORD 11                                  /* max length of a word */
  #define IN      1                                   /* inside a word */
  #define OUT     0                                   /* outside a word */
  
  /* print horizontal histogram */
  int
  main(void)
  {
      int c, i, nc, state;
      int len;                                        /* length of each bar */
      int maxvalue;                                   /* maximum value for wl[] */
      int ovflow;                                     /* number of overflow words */
      int wl[MAXWORD];                                /* word length counters */
  
      state = OUT;
      nc = 0;                                         /* number of chars in a word */
      ovflow = 0;                                     /* number of overflow words */
      /* INITIALIZE WORD LENGTH COUNTER */
      for (i = 0; i &lt; MAXWORD; ++i) {
          wl[i] = 0;
      }
      /* READ CHARACTERS UNTIL EOF */
      while ( (c = getchar() ) != EOF) {
          /* IF BLANK FOUND */
          if (c == ' ' || c == '\n' || c == '\t') {
              state = OUT;
              /* IF WORD FOUND */
              if (nc &gt; 0) {
                  /* INCREMENT WORD LENGTH COUNTER */
                  if (nc &lt; MAXWORD) {
                      ++wl[nc];
                  }
                  /* INCREMENT OVERFLOW COUNTER */
                  else {
                      ++ovflow;
                  }
              }
              nc = 0;
          }
          /* NEW WORD FOUND */
          else if (state == OUT) {
              state = IN;
              nc = 1;                                 /* beginning of a new word */
          }
          /* SAME WORD FOUND */
          else {
              ++nc;                                   /* inside a word */
          }
      }
      maxvalue = 0;
      /* FIND LARGEST WORD */
      for (i = 1; i &lt; MAXWORD; ++i) {
          if (wl[i] &gt; maxvalue) {
              maxvalue = wl[i];
          }
      }
      /* PRINT COUNTER HEADER */
      for (i = 1; i &lt; MAXWORD; ++i) {
          printf("%5d - %5d : ", i, wl[i]);
          /* FIND A COUNTER */
          if (wl[i] &gt; 0) {
              /* SCALE ITS HISTOGRAM */
              if ( (len = wl[i] * MAXHIST / maxvalue) &lt;= 0) {
                  len = 1;
              }
          }
          /* NO COUNTER FOUND */
          else {
              len = 0;
          }
          /* PRINT COUNTER LENGTH */
          while (len &gt; 0) {
              putchar('*');
              --len;
          }
          putchar('\n');
      }
      /* PRINT OVERFLOW COUNT */
      if (ovflow &gt; 0) {
          printf("There are %d words &gt;= %d\n", ovflow, MAXWORD);
      }
  
      return 0;
  }
  </code></pre>