title: loop does not continue after a 'space' is entered after a string input in C
body: <p>I have tried many methods but im still not sure why my loop does not continue after the user enters a space at the end of the input. Ideal im trying to take the sentences and store them in a singly linked list where each node will contain each line the user enters.</p>
  <pre><code>void addSentence(control* list)
  {
  sentence* sList;
  sentence* currentSentence;
  word* words;
  
  
  printf(&quot;Enter a Sentence:&quot;);
  char sentenceInput[1000];
  
  while(fgets(sentenceInput, 1000, stdin) != NULL &amp;&amp; sentenceInput[0] != '\n')
  {
     
      words = (word*)malloc(sizeof(word));
      words-&gt;pWord = sentenceInput;
      sList = createSentence(words);
      words-&gt;pWord = strtok(sentenceInput, &quot; &quot;);
  
      while(words-&gt;pWord != NULL)
      {
          if(list-&gt;firstSentence == NULL)
          {
              list-&gt;firstSentence = sList;
          }
          else
          {
              for(currentSentence = list-&gt;firstSentence; currentSentence-&gt;nextSentence != NULL; currentSentence = currentSentence-&gt;nextSentence);
              currentSentence-&gt;nextSentence = sList;
          }
          printf(&quot;%s &quot;, words-&gt;pWord);
          words-&gt;pWord = strtok(NULL, &quot; &quot;);
      }
  
  
      printf(&quot;Enter a Sentence:&quot;);
  }
  </code></pre>
  <p>}</p>
  <p>and here is the structure</p>
  <pre><code>    typedef struct{
      char* pWord;
      int numOfChar;
      int posOfWord;
      struct word* nextWord;}word;
  
  
  typedef struct{
      word* wordList;
      int posOfLine;
      int totalWords;
      struct sentence* nextSentence;}sentence;
  
  typedef struct{
      int sentenceCounter;
      struct sentence* firstSentence;}control;
  </code></pre>