list_init
Initializes the linked list specified by
list
. This operation must be called for
a linked list before the list can be used with any other
operation. The destroy
argument
provides a way to free dynamically allocated data when
list_destroy is called. For example, if the
list contains data dynamically allocated using
malloc, destroy
should be set to free to free the data as the
linked list is destroyed. For structured data containing several
dynamically allocated members, destroy
should be set to a user-defined function that calls
free for each dynamically allocated member as
well as for the structure itself. For a linked list containing
data that should not be freed, destroy
should be set to NULL.