CIS 15/615                                         INSTRUCTOR: RAVE HARPAZ

 

ASSIGNMENT # 4

 

The Preprocessor, modular programming and

Dynamic memory allocation.

 

Finalizing your phonebook database by adding and modifying existing functions according to new topics covered in class.

 

Program guidelines:

 

·       Divide your program into modules, that is your program should consist of 3 files; one of which is the header file, the other which is the implementation file (containing your functions), and the third, which will contain the main function.

 

·                           Storage for the array containing the phone book should now be dynamically allocated using malloc at the beginning of your program, and reallocated upon needs (after adding new records or when reading records from the data file) using realloc.

 

·       Add static and extern declarations to your program wherever you think is appropriate.

 

·       Add macros to your program wherever you think is appropriate, at least one of the macros should be a parameterized macro.

 

·       Write a short specification document.

 

·       Add an Update-record function, which will query the user for a record (by last name) and then using appropriate messages will guild the user through an update session. This function should first call the search function (which already exists from your previous assignment) to find the record that needs to be updated. The function should print the updated record after the request is completed.

    

·       To enable separate compilation and linkage you will have to follow the instructions specified in the separate compilation handouts.

 

·       Test your program with at least 10 records

 

·       Hand in all source files, data files and output.

 

 

 

Good luck !