difference between tab ,space and blank in C


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?


Answers:


Spaces and tabs have different representations in ASCII. <space> is 0x20, while <tab> is 0x09. When the program checks the current character, both possibilities need to be tested.

Also worth noting is that the newline character they are using is '\n', which is "Line Feed", the conventional newline character for Unix/Linux/BSD. On Windows, the typical newline is represented by "\r\n" or CRLF ("Carriage Return" and "Line Feed").

I don't know that characters like "vertical tab" are used much. Many of those "control characters" go back to the days when they were used to give printers instructions on how to move the head.