2017-11-30 21:00:47 +01:00
|
|
|
#ifndef LINKEDLIST_H_
|
|
|
|
#define LINKEDLIST_H_
|
|
|
|
|
|
|
|
struct Node {
|
|
|
|
struct Node *next;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
typedef struct Node LinkedList;
|
|
|
|
|
2017-12-19 21:00:02 +01:00
|
|
|
LinkedList* linkedlist_create(void);
|
2017-11-30 21:00:47 +01:00
|
|
|
|
2017-12-13 20:31:04 +01:00
|
|
|
void linkedlist_push(LinkedList **head, void *value);
|
2017-11-30 21:00:47 +01:00
|
|
|
|
|
|
|
void* linkedlist_pop(LinkedList **head);
|
|
|
|
|
2017-12-13 20:31:04 +01:00
|
|
|
void linkedlist_append(LinkedList **head, void *value);
|
2017-11-30 21:00:47 +01:00
|
|
|
|
|
|
|
void* linkedlist_poplast(LinkedList **head);
|
|
|
|
|
2017-12-02 16:24:31 +01:00
|
|
|
void* linkedlist_get(LinkedList **head, unsigned int index);
|
|
|
|
|
2017-12-13 20:31:04 +01:00
|
|
|
void linkedlist_each(LinkedList **head, void (*fun)(void*));
|
|
|
|
|
2017-11-30 21:00:47 +01:00
|
|
|
void linkedlist_destroy(LinkedList **head);
|
|
|
|
|
|
|
|
unsigned int linkedlist_size(LinkedList *head);
|
|
|
|
|
|
|
|
|
|
|
|
#endif // LINKEDLIST_H_
|