Functions
int list_append (
List *theList,
void* theItem
);
Parameters
Name | Description |
*theList | pointer to the list to add the item to |
*theItem | pointer to void, the item to append. |
Result: true on success
Abstract: Removes all items from a list.
void list_destroy (
List *theList
);
Will traverse all nodes in a list, first free()ing the item, and then removing the node.
void *list_getID (
List *theList,
long id
);
Parameters
Name | Description |
theList | pointer to list to search |
id | number of items to traverse into the list (from start) |
Result: pointer to item
Abstract: Get an item from the list
void *list_getItem (
List *theList,
void* item,
int (*compare
)(void*,void*));
Parameters
Name | Description |
theList | pointer to list to search |
item | item to look for (void*) |
compare | pointer to function to compare item to each node's item. They can be different types, but the compare function must be able to track this itself. |
Result: pointer to item
int list_new (
List *theList
);
Parameters
Name | Description |
*theList | pointer to list to be 'newed' |
Result: integer, true on success
void* list_traverse (
List *theList,
ListNode** current
);
Parameters
Name | Description |
theList | list to traverse |
current | Status variable (initially should be NULL) |
Result: next item in list
(Last Updated 4/21/2003)