CS167/467 C Programming
Fall 1999

The concordance: revisited

Goals

To write a program that uses structures and reads from a file.

Problem description

Take your concordance program and modify it to work with structures. Your program uses a single array for the concordance itself, i.e. an array of pointers to character strings. Alter this so that the array is an array of structures, each of which contains the pointer to the string and a count of the number of times each word has been seen. In addition, make the program read froma  file instead of from standard input.

Deliverables:

q       your source code, suitably commented and with good layout

q       the sample output produced by the program given the same input test that your original program produced.

q       your source code e-mailed to the grader, login name byao.

Notes and hints

q       You will have to modify any functions that have either of the original arrays as parameters, as well as all assignments to elements of either original array.

q       You may want to make the program read the input from a file whose name is given on the command line, but this is not essential to get full points.

q       The allocation of space for each new word remains exactly the same, except that your program will assign the pointer returned by AllocateString to a member of a structure instead of just an array element.

Due Date

Submit your completed assignment before 5pm. on Wednesday, December 8th.