libnds
Data Structures | Typedefs | Functions
dynamicArray.h File Reference

A dynamically resizing array for general use. More...

#include <stdlib.h>
#include <string.h>
#include <nds/ndstypes.h>

Data Structures

struct  DynamicArray
 A resizable array. More...
 

Typedefs

typedef struct DynamicArray DynamicArray
 A resizable array.
 

Functions

void DynamicArrayDelete (DynamicArray *v)
 Frees memory allocated by the dynamic array. More...
 
void * DynamicArrayGet (DynamicArray *v, unsigned int index)
 Gets the entry at the supplied index. More...
 
void * DynamicArrayInit (DynamicArray *v, unsigned int initialSize)
 Initializes an array with the supplied initial size. More...
 
bool DynamicArraySet (DynamicArray *v, unsigned int index, void *item)
 Sets the entry to the supplied value. More...
 

Detailed Description

A dynamically resizing array for general use.

Function Documentation

void DynamicArrayDelete ( DynamicArray v)

Frees memory allocated by the dynamic array.

Parameters
vThe array to delete
void* DynamicArrayGet ( DynamicArray v,
unsigned int  index 
)

Gets the entry at the supplied index.

Parameters
vThe array to get from.
indexThe index of the data to get.
Returns
The data or NULL if v is NULL or the index is out of range.
void* DynamicArrayInit ( DynamicArray v,
unsigned int  initialSize 
)

Initializes an array with the supplied initial size.

Parameters
vthe array to initialize
initialSizethe initial size to allocate
Returns
a pointer to the data, or NULL on error.
bool DynamicArraySet ( DynamicArray v,
unsigned int  index,
void *  item 
)

Sets the entry to the supplied value.

Parameters
vThe array to set
indexThe index of the data to set (array will be resized to fit the index).
itemThe data to set.
Returns
false if v is NULL or there isn't enough memory, true otherwise