title: How do I strcmp specifically for newline in C?
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main() {
      int counter1, counter2;
      char line[200] = &quot;&quot;; //store all words that don't need to be deleted
      char deleteWord[100]; //word that needs to be deleted
      char space;
      char word[100];
      scanf(&quot;%s&quot;, deleteWord);
  
      while (1) {
          scanf(&quot;%s&quot;, word);
  
          if (feof(stdin))
              break;
          // increment counter of total words
          ++counter1;
          if (strcmp(word, deleteWord) == 0) {
              // see if the word read in == delete word
              // increment counter of deleted words
              ++counter2;
          } else
          if (strcmp(word, &quot; &quot;) == 0) { // space is an actual space
              strcat(line, word);
              strcat(line, &quot; &quot;);
          } else
          if (strcmp(word, &quot;\n&quot;)) { // space a new line \n
              strcat(line, word);
              strcat(line, &quot;\n&quot;);
          }
      }
  
      printf(&quot;--NEW TEXT--\n%s&quot;, line);
  
      return 0;
  }
  </code></pre>
  <p>In summary, my code is supposed to remove a user input string (one or more words) from another user input string (containing or not containing the word(s)) and produce the output. The code removes the word but it adds a newline per word for each iteration. I believe it is doing this because the expression for the second <code>else if</code> is always true. However, when I properly add the <code>strcmp</code> function for the second <code>else if</code> statement, the code does not produce an output at all (no compiler errors - just missing input). Why is this happening and how do I do a <code>strcmp</code> function for a newline?</p>