Hello, I recently purchased K & R's book on C. I have a couple of questions. Here is the code that I have questions about:
my question is, what is this supposed to do? I mean I know it is supposed to count the input, but when I run this program if I type something in, what will it do? I get nothing and wasn't sure if I had missed something or not. I have read this part numerous times and just can't wrap my head around it. I know it is something simple and I am probably brain dead, but can anyone explain this?Code:#include <stdio.h> /* count characters in input; 2nd version */ main() { double nc; for (nc = 0; getchar() != EOF; ++nc) ; printf("%.0f\n", nc); }
I understand what the code does, I just don't know the result...
Thanks for any help,
/asenchi