CSE 271: Programming Assignment 5

Assigned: 21 February
Due: 27 February

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    2
to 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.

Submission Requirements

  1. As usual, the program must be named p5.c and must reside in the cse271.131/p5 subdirectory.
  2. 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.
  3. Your name must be in the comment section (along with appropriate description, etc.).
  4. Do a touch DONE when the program is ready to be collected.

Last revised: 19 February 2013.