Question: 2. Write a C program wordcount.c. The program should call getchar until EOF is encountered, and count the number of characters, words, and lines read.
2. Write a C program wordcount.c. The program should call getchar until EOF is encountered, and count the number of characters, words, and lines read. (Define a word to be a sequence of characters having ASCII values between 33 and 126.) For example, the screenshot below shows the running of the program twice. The first time I entered input from the keyboard; I signaled EOF by typing control-d at the beginning of the last line. The second time I redirected input to the file sonnets.txt. adminuserbadninuser-VirtualBox -/Desktop/SP2020 - HWS/HWI S goccount. -0 wordcount adminuser adminuser VirtualBox /Desktop/SP2020-MWS/HWI $ wordcount Computer Systems Spring 2020 I am done! Your text has 42 chars, 7 words, and 4 lines. adminuseradminuser VirtualBox /Desktop/SP2020-HWS/HWA sonnets.txt adesinusergadeginuser VirtualBox /Desktop/SP2020-WS/HWI Swordcount Your text has 160314 chars. 176B6 words, and 2629 lines adminuser Badminuser VirtualBox/Desktop/SP2020-HWS/ H S
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
