STATUS: stable Implementing a single-linked list.
More...
#include <stdio.h>
#include "definitions.h"
Go to the source code of this file.
Data Structures |
struct | SingleList |
| a single-linked list. More...
|
Functions |
SingleList * | slist_append (SingleList *l) |
| append an element to the list.
|
void | slist_free (SingleList *l) |
| recursively free list. The list->content pointer is NOT freed!
|
SingleList * | slist_index (const SingleList *l, int idx) |
| return the idx'th element in the list.
|
SingleList * | slist_init (void *content) |
| initialize SingleList element.
|
int | slist_length (const SingleList *l) |
| return the number of elements in a list.
|
void | slist_print (FILE *out, const SingleList *l, void(*print_content)(FILE *, void *)) |
| print a list.
|
Detailed Description
STATUS: stable Implementing a single-linked list.
Definition in file slist.h.
Function Documentation
SingleList* slist_append |
( |
SingleList * |
l |
) |
|
append an element to the list.
Definition at line 38 of file slist.c.
void slist_free |
( |
SingleList * |
l |
) |
|
recursively free list. The list->content pointer is NOT freed!
Definition at line 91 of file slist.c.
SingleList* slist_index |
( |
const SingleList * |
l, |
|
|
int |
idx | |
|
) |
| | |
return the idx'th element in the list.
If it does not exist, NULL is returned.
- Parameters:
-
| l | the head of the list |
| idx | the index |
- Returns:
- the idx'th list node or NULL
Definition at line 55 of file slist.c.
SingleList* slist_init |
( |
void * |
content |
) |
|
initialize SingleList element.
Definition at line 28 of file slist.c.
int slist_length |
( |
const SingleList * |
l |
) |
|
return the number of elements in a list.
Definition at line 81 of file slist.c.
void slist_print |
( |
FILE * |
out, |
|
|
const SingleList * |
l, |
|
|
void(*)(FILE *, void *) |
print_content | |
|
) |
| | |
print a list.
Definition at line 69 of file slist.c.