FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
linkedlist.h File Reference

Contains a really basic implementation of a linked list. More...

#include <stdint.h>
#include <stdbool.h>
Include dependency graph for linkedlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  list_node
struct  list

Functions

void list_init (list *obj)
 Initializes a list.
void list_clear (list *obj)
 Clears a lists ontents.
bool list_empty (list *obj)
 Checks if the list is empty.
void list_push_back (list *obj, void *data)
 Adds an object to the list.
void * list_pop_back (list *obj)
 Removes the last element from the list and returns it's value.
struct list_nodelist_at (list *obj, int index)
 Gets a node of a list.
void * list_get (list *obj, int index)
 Gets the contents of a list.

Detailed Description

Contains a really basic implementation of a linked list.

Author
GAMINGNOOBdev (https://github.com/GAMINGNOOBdev)
Version
0.1
Date
2023-12-20

Definition in file linkedlist.h.

Function Documentation

◆ list_at()

struct list_node * list_at ( list * obj,
int index )

Gets a node of a list.

Parameters
objThe list object
indexIndex of the node
Returns
The node, NULL if not in range

◆ list_clear()

void list_clear ( list * obj)

Clears a lists ontents.

Parameters
objThe list that'll be cleared

◆ list_empty()

bool list_empty ( list * obj)

Checks if the list is empty.

Parameters
objThe list which will be checked
Returns
true if the list is empty, otherwise false

◆ list_get()

void * list_get ( list * obj,
int index )

Gets the contents of a list.

Parameters
objThe list object
indexIndex of the element
Returns
The stored element, NULL if not in range

◆ list_init()

void list_init ( list * obj)

Initializes a list.

Parameters
objThe new list object

◆ list_pop_back()

void * list_pop_back ( list * obj)

Removes the last element from the list and returns it's value.

Parameters
objThe list that'll be used
Returns
The stored element

◆ list_push_back()

void list_push_back ( list * obj,
void * data )

Adds an object to the list.

Parameters
objThe list that'll be used
dataThe element that'll be added to the list