I came across the following code in Ritchie and kernighan C,for counting no. of words ..
#include<stdio.h>
#define IN 1
#define OUT 0
main()
{
int c,n1,nw,nc,state;
state = OUT;
n1 =nw = nc = 0;
while((c = getchar())!=EOF)
{
++nc;
if(c == '\n')
++n1;
if(c == ' '||c == '\n' ||c == '\t')
state = OUT;
else if(state == OUT)
{
state = IN;
++nw;
}
}
printf("%d %d %d\n",n1,nw,nc);
}
I guess here c == ' '
and c == '\t'
are doing the same job.
Can someone explain me difference between tab, space, whitespace, blank, form feed and vertical tab?