title: C - Prompted for a second input and does nothing
body: <p>this is my code below. What it does is not the issue. The issue is that once it is run, I put in my input and if its too small it will ask for input again on the second line which appears to have no affect the flow of my program. If I fill the buffer (which I'm assuming 100 or more) then I am not asked for a second prompt.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
    int ch;
    char x[3];
    char *word, string1[100];
    x[0]='y';
  
    while(x[0]=='y'||x[0]=='Y')
    {
      fgets(string1, 100, stdin);
      while ( (ch = fgetc(stdin)) != EOF &amp;&amp; ch != '\n');
      printf("The string is: %s", string1);
  
      word = strtok(string1, " ");
      while(word != NULL)
      {
        printf("%s\n", word);
        word = strtok(NULL, " ");
      }
  
      printf("Run Again?(y/n):");
      fgets(x, 2, stdin);
      while ( (ch = fgetc(stdin)) != EOF &amp;&amp; ch != '\n');
    }
  
    return 0;
  }
  </code></pre>
  
  <p>EDIT:
   I have replaced, </p>
  
  <pre><code>    fgets(string1, 100, stdin);
      while ( (ch = fgetc(stdin)) != EOF &amp;&amp; ch != '\n');
  </code></pre>
  
  <p>With, </p>
  
  <pre><code> fgets(string1, 100, stdin);
   if (string1[98] != '\n' &amp;&amp; string1[99] == '\0') 
   { 
     while ( (ch = fgetc(stdin)) != EOF &amp;&amp; ch != '\n'); 
   }
  </code></pre>