title: Counting words program in C omitting double spaces and punctuation
body: <p>I am doing a course on the basics of C programming, I've been given a task to create a program that counts the number of words in a sentence, I've achieved this, however I have a secondary task to stop the program from counting punctuation, on top of this if i type in a consecutive space i need the program to ignore it, i don't know how to get round it. could anyone point me into the right direction, I am not looking for anyone to write the code for me.</p>
  
  <p>here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      const char end = '.';
      int words = 1;
      printf("please enter a sentence: \n");
      char c = getchar();
      while (c != end)
      {
          c = getchar();
          if (c == ' ')
              words++;
      }
      printf("the total number of words is %d", words);
      getchar();
      getchar();
  }
  </code></pre>