How could I write a program that reads a file of words (assumed to be in lower case letters) and prints out the total number of words in the file?
Would it be something like this?:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main()
{
int ch;
FILE *input_ptr;
if((input_ptr=fopen(“infile.txt”,”rt”))==NULL)
{
printf(“Cannot open input file/n”);
exit(1);
}
fclose(input_ptr);
return 0;
}
I don't know how to do the bit in the middle.
If anyone can help, thank you very much.