This is the code :
Code:
#include <stdio.h>
#define IN 1 /* Inside a word */
#define OUT 0 /* Outside a word */
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);
}
Ok,so what i don't understand (i recently started programming) is IN and OUT.I know how the symbolic constants work.What i don't get is the code.IN and OUT (outside ,inside the word).I know what define does exactly.But how do these 2 constants become inside and outside a word.I preety much don't understand anything about the IN and OUT now.Everything else is understandable in this code.
But is there anyone who can explain to me how the IN and OUT are functioning???
Thanks,Filster7(Sorry to bother) !