libnds
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Typedefs | Functions
linkedlist.h File Reference

A simple doubly linked, unsorted list implementation. More...

#include <malloc.h>

Data Structures

struct  LinkedList
 A node for the linked list. More...
 

Typedefs

typedef struct LinkedList LinkedList
 A node for the linked list.
 

Functions

LinkedListlinkedlistAdd (LinkedList **front, void *data)
 Adds data to a linked list. More...
 
void linkedlistRemove (LinkedList *node)
 Removes a node from a linked list. More...
 

Detailed Description

A simple doubly linked, unsorted list implementation.

Function Documentation

LinkedList* linkedlistAdd ( LinkedList **  front,
void *  data 
)

Adds data to a linked list.

This will only store the pointer to the data, so you have to make sure that the pointer stays valid.

Parameters
frontA pointer to a pointer to the front of the linked list (or a pointer to NULL if you don't have a linked list yet).
dataA pointer to the data you want to store.
Returns
A pointer to the new node, which is also the new front, or NULL if there is not enough memory.
void linkedlistRemove ( LinkedList node)

Removes a node from a linked list.

The data pointer of the node will be lost after this, so make sure you don't need it anymore.

Parameters
nodeThe node you want to remove.