Multi-character character constant warning
Hi,
I'm trying to learn C and I'm using K&R second edition. I am copying this example in the book called 'Line counting'. The code is
Code:
#include <stdio.h>
main()
{
int c, nl;
nl = 0;
while((c=getchar()) != EOF){
if (c == '/n')
++nl;}
printf("%d\n",nl);
}
When I compile it, I get an error.
Code:
visuthan@visuthan:~/Projects/C$ gcc line_counter.c -o line_counter
line_counter.c: In function ‘main’:
line_counter.c:8:12: warning: multi-character character constant [-Wmultichar]
Can someone explain what this means? I tried reading online but I really can't figure out the replies in most posts.
Also, can anyone tell me how I can create an EOF situation when getchar() is listening?