Im trying to learn C using The C programming language second edition, based on the reviews section here. Im not learning to program, i have experience with other languages, mostly VB ,but some C++ and a little tcl/tk.
Im following the examples in this book and im some way into the, but none of the examples involving word and line counting are returning any out put.
Code:
#include <stdio.h>
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
this should return the number of characters on the line you typed in. I takes the input but then returns nothing. Im thinking this may have something to do with the EOF, but that doesnt seem like a problem between unix's. This example was compiled on OSX because thats what i was sitting at when i picked up the book. It have between 4. something, cheers for any help