libcproject
C static library easier to use than libc (C standard library).
array_list.h File Reference
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "types.h"
Include dependency graph for array_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  array_list
 A dynamic array implementation. More...
 

Macros

#define ARRAY_LIST_INITIAL_CAPACITY   10
 

Functions

struct array_listarray_list_initialization ()
 Initializes a new array list. More...
 
struct array_listarray_list_initialization_with_capacity (size_t capacity)
 Initializes a new array list with a capacity. More...
 
void array_list_add (struct array_list *list, void *element)
 Adds an element to the end of the array list. More...
 
void array_list_remove (struct array_list *list, size_t index)
 Removes an element from the array list. More...
 
void * array_list_get (struct array_list *list, size_t index)
 Gets an element from the array list. More...
 
void array_list_free (struct array_list *list)
 Frees the array list. More...
 

Data Structure Documentation

◆ array_list

struct array_list

A dynamic array implementation.

Since
v1.2.0

Definition at line 17 of file array_list.h.

Data Fields
void ** data
size_t size
size_t capacity
size_t capacity_step

Macro Definition Documentation

◆ ARRAY_LIST_INITIAL_CAPACITY

#define ARRAY_LIST_INITIAL_CAPACITY   10

Definition at line 11 of file array_list.h.

Function Documentation

◆ array_list_initialization()

struct array_list* array_list_initialization ( )

Initializes a new array list.

Since
v1.2.0

◆ array_list_initialization_with_capacity()

struct array_list* array_list_initialization_with_capacity ( size_t  capacity)

Initializes a new array list with a capacity.

Since
v5.0.0

◆ array_list_add()

void array_list_add ( struct array_list list,
void *  element 
)

Adds an element to the end of the array list.

Parameters
list
element
Since
v1.2.0

◆ array_list_remove()

void array_list_remove ( struct array_list list,
size_t  index 
)

Removes an element from the array list.

Parameters
list
index
Since
v1.2.0

◆ array_list_get()

void* array_list_get ( struct array_list list,
size_t  index 
)

Gets an element from the array list.

Parameters
list
index
Returns
void*
Since
v1.2.0

◆ array_list_free()

void array_list_free ( struct array_list list)

Frees the array list.

Parameters
list
Since
v3.0.0