|
Dynarray.c
|
#include <stdlib.h>Go to the source code of this file.
Data Structures | |
| struct | array_info |
| Saves stats about the array for memory handling. More... | |
Functions | |
| void * | construct_array (size_t capacity, size_t item_size) |
| Creates a dynamic array. More... | |
| array_info * | get_array_info (void *array) |
| Retrieves the array information of a given array. More... | |
| void | insert_at (void *array, void *item, int pos) |
| Inserts an item in a specific slot, overwriting any existing item. More... | |
| size_t | array_length (void *array) |
| Gets the length of the array. More... | |
| void | push_back (void *array, void *item) |
| Pushes to the back of the array length. More... | |
This header file defines the publically available functions
| size_t array_length | ( | void * | array | ) |
Gets the length of the array.
| array | A pointer to the array |
| void* construct_array | ( | size_t | capacity, |
| size_t | item_size | ||
| ) |
Creates a dynamic array.
| capacity | The initial number of available slots for the array |
| item_size | The size, in bytes, of the item that will be stored in this array |
| array_info* get_array_info | ( | void * | array | ) |
Retrieves the array information of a given array.
| Array | a pointer to a dynamic array |
| void insert_at | ( | void * | array, |
| void * | item, | ||
| int | pos | ||
| ) |
Inserts an item in a specific slot, overwriting any existing item.
| array | A pointer to the array |
| item | The item to be inserted |
| pos | The, zero-indexed, position to place the item |
| void push_back | ( | void * | array, |
| void * | item | ||
| ) |
Pushes to the back of the array length.
| array | A pointer to the array |
| item | A pointer to the item to insert |