list.c is an implementation of a linked list in C.
Example:
#include <stdio.h>
#include <stdlib.h>
#include "list.h"
int main (int argc, char *argv[])
{
list *l = list_new();
list_add(l, "hello");
list_add(l, "world");
char *hello = list_get(l, 0);
char *world = list_get(l, 1);
printf("%s %s\n", hello, world);
free(hello);
free(world);
list_free(l);
return 0;
}Look at ./test.c for a longer example.
With clib:
$ clib install AjayMT/list.cOr make it and use the list.o file.
Create a new list. This function returns a pointer to the list.
Return a new list containing items from beg to end (excluding end) in l.
Return the value at i in l. You should free the value you get.
Append val to l.
Set the value at i to val in l.
Insert val into l at index i.
Remove item at i in l.
Return the number of items in l.
Return the index of val in l.
Free everything in l.
$ make testMIT. See ./LICENSE for details.