ASCOT5
Loading...
Searching...
No Matches
Functions
list.c File Reference

Simple linked list. More...

#include <stdlib.h>
#include "list.h"

Go to the source code of this file.

Functions

void list_int_create (list_int_node **list)
 Create an empty list.
 
void list_int_free (list_int_node **list)
 Deallocate this list and all lists it is linked to.
 
void list_int_add (list_int_node *list, int data)
 Add new node to the end of the chain.
 
int list_int_get (list_int_node *list, int index)
 Retrieve the data stored in a list node.
 
int list_int_size (list_int_node *list)
 Get list size.
 

Detailed Description

Simple linked list.

Linked list where each node stores an int data and a pointer to the next node in chain.

Definition in file list.c.

Function Documentation

◆ list_int_create()

void list_int_create ( list_int_node ** list)

Create an empty list.

Parameters
listpointer to the created list

Definition at line 16 of file list.c.

◆ list_int_free()

void list_int_free ( list_int_node ** list)

Deallocate this list and all lists it is linked to.

Parameters
listpointer to the list to be freed

Definition at line 28 of file list.c.

◆ list_int_add()

void list_int_add ( list_int_node * list,
int data )

Add new node to the end of the chain.

Parameters
listlist node to which new node is linked
dataint value to be stored in the new node

Definition at line 48 of file list.c.

◆ list_int_get()

int list_int_get ( list_int_node * list,
int index )

Retrieve the data stored in a list node.

Parameters
listlist node
indexnode index where data is retrieved, zero refers to current node
Returns
the stored data

Definition at line 69 of file list.c.

◆ list_int_size()

int list_int_size ( list_int_node * list)

Get list size.

Parameters
listlist node
Returns
number of nodes this node is linked to

Definition at line 86 of file list.c.