title: EOF symbolic constant
body: <p>From <em>The C Programming Language</em>: </p>
  
  <pre><code>int c;
  while ((c = getchar()) != EOF)
      putchar(c);
  </code></pre>
  
  <p>"... The solution is that <code>getchar</code> returns a distinctive value when there is no more input, a value that cannot be confused with any real character. This value is called <code>EOF</code>, for "end of file." We must declare <code>c</code> to be a type big enough to hold any value that <code>getchar</code> returns. We can't use <code>char</code> since <code>c</code> must be big enough to hold <code>EOF</code> in addition to any possible <code>char</code>."</p>
  
  <p>I checked in <code>stdio.h</code> and printed the value of EOF on my system, and it's set to <code>-1</code>. On my system, <code>chars</code> are signed, although I understand that this is system dependent. So, <code>EOF</code> can fit in a <code>char</code> for my system. I rewrote the small routine above by defining <code>c</code> to be a <code>char</code> and the program works as intended. There's also a character in the ASCII character table <a href="http://www.asciitable.com/">here</a> that appears to have a blank character corresponding to 255 which appears to act like <code>EOF</code>. </p>
  
  <p>So, why does it appear that ASCII has a character (255) designated for EOF? This seems to contradict what is said in the <em>The C Programming Language</em> book.</p>