hugom
May 16th, 2011, 09:31 AM
Hi there,
I'm trying to teach myself C programming while I'm injured and I have a book for beginners but I have got a bit confused at this point.
This program is meant to count the number of characters in something, but when I compile and run it it just comes up with a blank terminal window.
I know this might be a pretty stupid question but would really like to know what to do. This is the code I use here ..
#include <stdio.h>
/* count characters in input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
Any help would be hugely appreciated, Cheers.
I'm trying to teach myself C programming while I'm injured and I have a book for beginners but I have got a bit confused at this point.
This program is meant to count the number of characters in something, but when I compile and run it it just comes up with a blank terminal window.
I know this might be a pretty stupid question but would really like to know what to do. This is the code I use here ..
#include <stdio.h>
/* count characters in input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
Any help would be hugely appreciated, Cheers.