Hi
This is a very wierd problem. It's a program for an exercise in The C Programming Language 2nd Edition (K&R), but using CTRL + D doesn't work for this problem. I've this workable version, compiled it and it worked fine, this program is 99% of that program with one exception: the variable "nn" for "new blank" is named as "nb" (makes more sense). Aside from that, there's no major difference between these two files and I've no idea why this is not working.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int c, nn, nt, nl;
nn = nt = nl = 0;
while ((c == getchar()) != EOF) {
if (c == ' ')
++nn;
else if (c == '\t')
++nt;
else if (c == '\n')
++nl;
}
printf("%d %d %d\n", nn, nt, nl);
return EXIT_SUCCESS;
}