osurs
0.0.1
|
Linkedlist data structure. More...
Functions | |
void | linked_list_init (LinkedList *list) |
Initialize a LinkedList structure. More... | |
LinkedList * | linked_list_create () |
Create a new LinkedList structure. More... | |
void | linked_list_add_first (LinkedList *list, void *data) |
Add an element to the beginning of a LinkedList. More... | |
void | linked_list_add_last (LinkedList *list, void *data) |
Add an element to the end of a LinkedList. More... | |
void * | linked_list_remove_first (LinkedList *list) |
Remove the first element from a LinkedList. More... | |
void * | linked_list_remove_last (LinkedList *list) |
Remove the last element from a LinkedList. More... | |
void * | linked_list_get_first (LinkedList *list) |
Get the first element of a LinkedList. More... | |
void * | linked_list_get_last (LinkedList *list) |
Get the last element of a LinkedList. More... | |
void | linked_list_clear (LinkedList *list) |
Clear all elements from a LinkedList. More... | |
void | linked_list_free (LinkedList *list) |
Free a LinkedList structure. More... | |
Linkedlist data structure.
void linked_list_add_first | ( | LinkedList * | list, |
void * | data | ||
) |
Add an element to the beginning of a LinkedList.
This function adds an element to the beginning of a LinkedList.
list | The LinkedList to which the element will be added. |
data | The element to be added to the list. |
void linked_list_add_last | ( | LinkedList * | list, |
void * | data | ||
) |
Add an element to the end of a LinkedList.
This function adds an element to the end of a LinkedList.
list | The LinkedList to which the element will be added. |
data | The element to be added to the list. |
void linked_list_clear | ( | LinkedList * | list | ) |
Clear all elements from a LinkedList.
This function removes all elements from a LinkedList, but does not free the list structure itself.
list | The LinkedList to be cleared. |
LinkedList* linked_list_create | ( | ) |
Create a new LinkedList structure.
This function creates a new LinkedList structure and returns a pointer to it. The new structure is initialized with its head and tail pointers set to NULL and its size set to 0.
void linked_list_free | ( | LinkedList * | list | ) |
Free a LinkedList structure.
This function frees a LinkedList structure, including all nodes and their data.
list | The LinkedList structure to be freed. |
void* linked_list_get_first | ( | LinkedList * | list | ) |
Get the first element of a LinkedList.
This function returns a pointer to the first element of a LinkedList, without removing it from the list. If the list is empty, the function returns NULL.
list | The LinkedList from which the first element will be returned. |
void* linked_list_get_last | ( | LinkedList * | list | ) |
Get the last element of a LinkedList.
This function returns a pointer to the last element of a LinkedList, without removing it from the list. If the list is empty, the function returns NULL.
list | The LinkedList from which the last element will be returned. |
void linked_list_init | ( | LinkedList * | list | ) |
Initialize a LinkedList structure.
This function initializes a LinkedList structure by setting its head and tail pointers to NULL and its size to 0.
list | The LinkedList structure to be initialized. |
void* linked_list_remove_first | ( | LinkedList * | list | ) |
Remove the first element from a LinkedList.
This function removes the first element from a LinkedList and returns a pointer to it. If the list is empty, the function returns NULL.
list | The LinkedList from which the element will be removed. |
void* linked_list_remove_last | ( | LinkedList * | list | ) |
Remove the last element from a LinkedList.
This function removes the last element from a LinkedList and returns a pointer to it. If the list is empty, the function returns NULL.
list | The LinkedList from which the element will be removed. |