Abstract
Practice your C programming skills and debugging techniques by fixing the bugs in the provided indexing program.Details
You've just taken a new job, and the first thing you've been assigned to do is to fix the program that your predecessor had written but not debugged. The program is an indexer -- it takes a text file provided via standard input and outputs a list of all words found and the line number on which the word was found. So, for example, given the file:The cat saw the rat. The cat ate the rat.the program would output the following:No. of distinct words: 6 The : 1 2 ate : 2 cat : 1 2 rat : 1 2 saw : 1 the : 1 2to show that, for example, the word cat was found on line 1 and line 2.Your job is to:
Unfortunately, your predecessor was not a good programmer; there are relatively few comments, and some code is a little complicated. You'll also need to generate your own test input files, but make sure you at least test on files such as this assignment.
- Fix the compilation problems.
- Fix any bugs that cause the program to crash or act abnormally.
- Make it possible for the program to work on any amount of input (assuming the system has enough memory).
- Summarize the changes you made in the top-of-file comments.
Submission Requirements
- As usual, the program must be named p5.c and must reside in the cse271.131/p5 subdirectory.
- Create and use an appropriate Makefile that will compile your program using make into an executable named p5, and will clean the directory with make clean.
- Your name must be in the comment section (along with appropriate description, etc.).
- Do a touch DONE when the program is ready to be collected.