SLIDE 1
Carleton University Department of Systems and Computer Engineering SYSC 2006 - Foundations of Imperative Programming - Winter 2012 Extra Programming Exercises These exercises review almost every concept covered during the term, except for recursive functions. During Labs 5 and 6, you prototyped some functions for a list collection. Later in the term, we looked at two approaches to implementing the list's data structure using a C struct. In the first implementation, the list's capacity was fixed at compile-time, In the second implementation, the list's capacity was specified at run-time. Exercise 1
- Open project intlist_v3. The function prototypes in intlist_v3.h and function definitions
in intlist_v3.c were presented in one of the lectures. In addition, the project contains a program (see test_list.c) that tests these functions.
- Read the header comments for intlist_get and intlist_set, and finish the implementations
- f these functions. Modify test_list.c to test these functions.
- In intlist_v3.h, uncomment the function prototypes for intlist_index, intlist_count and
intlist_contains. In intlist_v3.c, write the implementations of these functions.You implemented these functions for Lab 5, and you should be able to reuse much of this
- code. (The biggest change is that, instead of passing an array and its length (size) as
function arguments, you are now passing a pointer to an IntList structure.) Modify test_list.c to test these functions.You should be able to reuse much of the test code you wrote for Lab 5. Run the tests, and make any necessary corrections.
- In intlist_v3.h, uncomment the function prototypes for intlist_delete and
intlist_remove. In intlist_v3.c, write the implementations of these functions. You implemented these functions for Lab 6, and you should be able to reuse much of this
- code. Note that the function return types have changed from Lab 6. Previously, the
functions returned the size of the modified list, or -1 to indicate that they weren't
- successful. The return types are now _Bool. The functions should return true if they