I am testing out code from the book "The C programming Language" and I would like to know what is the value of EOF and how can I find it out? I tried referencing the value with a pointer of some kind but I just get a const pointer error. In anywise, below is my code and I would like to know why is there no output upon clicking enter:
#include <stdio.h>
#define IN 1 /*inside a word*/
#define OUT 0 /*outside a word*/
/* count lines, words, and characters in input*/
main()
{
int c, nl, nw, nc, state;
state = OUT;
nl = nw = nc = 0;
while ((c = getchar()) != EOF){
++nc;
if (c == '/n')
++nl;
if (c == ' ' || c == '\n' || c == '\t')
state = OUT;
else if (state == OUT){
state = IN;
++nw;
}
}
printf("%D %D %D\n", nl, nw, nc);
}