On Thu, Nov 18, 2010 at 11:45:59AM -0500, Joy Puglisi wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I'm learning C and this is the program: > > #include <stdio.h> > main() > { > double nc; > for (nc = 0; gechar() != EOF; ++nc); > printf("%.0f\n", nc); > } > > But I just realized I don't know how to do EOF. I tried Ctrl+D but > it just ends the program without displaying any output like printf > says. How do I properly EOF so that it doesn't end the program but > have the particular function read EOF?
A Ctrl-D on a new line should (and does) do the job. -Otto