title: K&R Chapter 1.5.4: "How would you test the word count program?"
body: <p>Beginner here.</p>
  
  <p>In the ANSI C textbook by K&amp;R, page 20, they ask: How would you test the word count program?</p>
  
  <p>I have copied exactly from the text book, using the CodeBlocks IDE, console application. I have seen many great input tests online, but my question is even dumber. How do I actually input something? Nothing happens when I press enter. Do I have this problem because I am using an IDE and therefore not learning how to run C programs properly?
  Thanks in advance. <a href="https://i.stack.imgur.com/OQQzg.png" rel="nofollow noreferrer">I added a picture to show you what I mean</a></p>
  
  <p>Here is the code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #define IN 1    /* inside a word */
  #define OUT 0   /* outside a word */
  
  /* counts lines, words and characters as input */
  
  main()
  {
      int c, nl, nw, nc, state;
  
      state = OUT;
      /* set these three constants to 0: */
      nl = nw = nc = 0;
      while ((c = getchar()) != EOF){
          ++nc;
          if (c == '\n')
              ++nl;
              /* || == OR (&amp;&amp; == AND)
              evaluation of the following line
              will stop as soon as the truth or
              falsehood is known, so the order matters */
          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>