COMP1927 13s1 COMP1927 13s1 Final Exam Computing 2
[Instructions] [C language]
[Q1] [Q2] [Q3] [Q4] [Q5] [Q6] [Q7] [Q8] [Q9]

Question 2 (10 marks)

In the q2 directory is a simple List ADT and a small driver which reads a sequence of integers into a List, displays the List, then reverses it, and finally displays the reversed List. To get a better idea of how this program is supposed to work, look at the testing examples in the q2/tests directory.

The ListReverse() function in the ADT provides the functionality to revrese lists. The following diagram shows how it works on a sample List:

Implement the ListReverse() function in the file List.c. You may implement any additional functions that you want, but you must maintain the current ListReverse() function interface.

The q2 directory also contains a Makefile which has two major behaviours:

make q2    # build the q2 program, which invokes the List functions
make test  # apply the tests in q2/tests to the q2 program

Once you are satisfied with your program, submit it using the command:

submit q2

This will make a copy of the XXX.c file from the q2 directory as your answer for this question. You can run the submit command as many times as you like, but make sure that your final submission compiles without any errors or warnings. Test your program thoroughly, possibly using test cases additional to those supplied. Your program will be tested using inputs which are different to the examples in the q2/tests directory.

If, at some stage, you need to "re-install" the files (although you should not need to), you can copy all of the original files into the q2 directory by running the command:

re-start q2

Beware: this will overwrite all of your exsting files for this question, so only do it if you seriously mess things up.