libnds
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
linkedlist.h File Reference

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

Data Structures

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

Typedefs

typedef struct LinkedList LinkedList
 A node of the linked list.
 

Functions

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

Detailed Description

A simple doubly linked, unsorted list implementation.

Function Documentation

◆ linkedlistAdd()

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.

◆ linkedlistRemove()

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.