C Linked List Activity


For this activity you will write a basic linked list API. You will create unit tests in unit_tests.c to thoroughly test your code. The linked list API will provide the following functions, which you should implement in order:

  1. length() - iterate over the list and count the number of nodes.
  2. push() - add a new node to the begininng of the list. This means allocating space in memory.
  3. pop() - remove the top node, freeing any memory
  4. appendNode() - add a new node to the end of the list
  5. copyList() - make a second copy of the list. You may want to create a compareList function for your unit test.
  6. freeList() - release all memory used by the head list. I expect two unit tests: one for an empty list and one for a list with at least two entries. Note that grading will include a manual inspection of your implementation.


Create specific, rigorous tests for each method. Grading will be done by using an instructor created set of unit tests so you need to be thorough!

Initial Code

Use this archive and fill in the linked.c and unit_tests.c files with your solutions: linked.zip.


Submit this to linkedList in your Git repository pushbox. You must also submit an Activity Journal..
Create an entry in your journal for each of the API functions. Include in that entry the time you spent creating unit tests for that API function.