Use case:
#include
#include
#include "linked_list.h"
int main(int ac, const char *av[])
{
list_t *root = constructor; #Init linked List ! It's mandatory
for (size_t i = 0; i < ac; i++) {
push_back(&root, av[i]); #Add to the end of the list
}
for (size_t i = 0; i < size(list); i++) {
char *str = get_position(root, i);
printf("argument: %s\n", str);
}
destructor(root); #Clean your list
}
list_t *constructor();
void destructor(list_t *);
void push_front(list_t **, void *);
void push_back(list_t **, void *);
void push_position(list_t **, size_t, void *);
void pop_front(list_t **);
void pop_back(list_t **);
void pop_position(list_t **, size_t);
void pop_ptr(list_t **, void *);
void *get_front(list_t *);
void *get_back(list_t *);
void *get_position(list_t *, size_t);
bool empty(list_t *);
size_t size(list_t *);
With gcc:
gcc *.c -L{PATH_LIB_DIR} -llinked -I{PATH_INCLUDE_DIR}