Print the length of words as a vertical histogram I thought I'd give it a shot. What I came up with is from a culmination of my last two submissions, incorporating most of the feedback from this community, including better naming of variables, initialization, and making my program a bit more user-friendly. I'm not sure which optimizations I can make or if there are any issues with my code. 

Any feedback is welcome!

#include &lt;stdio.h&gt;

/* print the length of words as input to a histogram with vertical bars */
int main(void) {
  int c, i, j;
  int word_length = 0;
  int max_word_frequency = 0;
  int histogram[10] = {0};

  putchar('&gt;');
  while ((c = getchar()) != EOF &amp;&amp; word_length &lt; 10) {
    if (c != ' ' &amp;&amp; c != '\n' &amp;&amp; c != '\t') {
      ++word_length;
    }
    else {
      ++histogram[word_length];
      word_length = 0;
    }
  }
  for (i = 0; i &lt; 10; ++i) {
    printf("%d ", i);
    if (histogram[i] &gt; max_word_frequency)
      max_word_frequency = histogram[i];
  }
  putchar('\n');
  for (i = 0; i &lt; max_word_frequency; ++i) {
    for (j = 0; j &lt; 9; ++j) {
      if (histogram[j] &gt; 0) {
         printf("x ");
         histogram[j] = histogram[j] -1;
      }
      else {
         printf("  ");
      }
    }
  putchar('\n');
  }
}
main()

Your main() does three things: print a prompt, count the frequencies, and print the histogram.  The latter two, in particular, are well-defined complex tasks, they each deserve to be a function.

If the input is redirected from a file, rather than typed directly on the console, then the &gt; prompt just messes up the output.  To see if standard input is a console, you should test isatty() on Unix, or _isatty() on Windows.

int main() {
    int histogram[21];
    if (isatty(fileno(stdin))) {
        putchar('&gt;');
    }
    count_word_lengths(stdin, histogram, sizeof histogram / sizeof histogram[0]);
    print_histogram(histogram, sizeof histogram / sizeof histogram[0]);
}


Counting

If the input ends abruptly with a word followed by EOF, with no intervening whitespace, then the last word doesn't get counted.

Instead of if (c != ' ' &amp;&amp; c != '\n' &amp;&amp; c != '\t'), consider using tests like isspace() and ispunct().  By the way, you are treating punctuation as if they were part of words, which is probably not the right behaviour.

If the input contains any word with length 10 or greater, then the counting terminates prematurely with no indication that anything went wrong.  (Personally, I'd choose to count all excessively long words as if it were the maximum length supported by the histogram array.)

Printing

Destroying the histogram data as you print is a bad idea, especially if it will cause a print_histogram() function to wipe out its input parameter.

Once you fix that, the printf("x ") and printf("  ") would be better with a ternary expression.

for (int row = 1; row &lt;= max_word_frequency; ++row) {
    for (int i = 0; i &lt; 9; ++i) {
        printf(row &lt;= histogram[i] ? "x " : "  ");
    }
    putchar('\n');
}