title: C comparing char to "\n" warning: comparison between pointer and integer
body: <p>I have the following part of C code:</p>
  
  <pre><code>char c;
  int n = 0;
  while ( (c = getchar()) != EOF ){
      if (c == "\n"){
          n++;
      }
  }
  </code></pre>
  
  <p>during compilation, compiler tells me </p>
  
  <pre><code>warning: comparison between pointer and integer [enabled by default]
  </code></pre>
  
  <p>The thing is that if to substitute <code>"\n"</code> with <code>'\n'</code> there are no warnings at all.
  Can anyone explain me the reason? Another strange thing is that I am not using pointers at all.</p>
  
  <p>I am aware of the following questions</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/8435432/warning-comparison-between-pointer-and-integer-enabled-by-default-in-c">warning: comparison between pointer and integer [enabled by default] in c</a></li>
  <li><a href="https://stackoverflow.com/questions/5654685/warning-comparison-between-pointer-and-integer-in-c">warning: comparison between pointer and integer in C</a></li>
  </ul>
  
  <p>but in my opinion they are unrelated to my question.</p>
  
  <p>PS. If instead of <code>char c</code> there will be <code>int c</code> there will be still warning.</p>