Linked List
Linked List implementation in C
|
Linked list implementation. More...
#include "Linked_list.h"
Functions | |
void | list_init (list_t *list, size_t dataSize) |
void | list_free (list_t *list) |
void | list_destroy (list_t *list) |
void | list_push (list_t *list, const void *data) |
void | list_push_front (list_t *list, const void *data) |
uint8_t | list_pop (list_t *list, void *data) |
uint8_t | list_pop_front (list_t *list, void *data) |
uint8_t | list_get_by_index (list_t *list, uint8_t index, void *data) |
void | list_print (list_t *list, void(*printFn)(const void *data)) |
void | list_for_each (list_t *list, void(*eachFn)(const void *data, void *arg), void *arg) |
uint8_t | list_size (list_t *list) |
Linked list implementation.
To use the linked list implementation, include this header file as follows:
A Linked List is used to implement different data structures like queues and state machines. The behaviour of a Linked List is similar to a Last In First Out (LIFO) memory but methods to push and pop to the front of the list are also implemented.
The Linked List implementation provides APIs to write and get elements from the linked list. The following code example initializes the linked list, writes to the linked list, and then gets elements from the linked list.