Dynamic arrays

The darray_t data type manages an array of pointers of type void \*, allocating more memory when necessary. Declared in pbc_darray.h.

void darray_init(darray_t a)

Initialize a dynamic array a. Must be called before a is used.

void darray_clear(darray_t a)

Clears a dynamic array a. Should be called after a is no longer needed.

void darray_append(darray_t a, void *p)

Appends p to the dynamic array a.

void * darray_at(darray_t a, int i)

Returns the pointer at index i in the dynamic array a.

void darray_remove_index(darray_t a, int n)

Removes the pointer at index i in the dynamic array a.

int darray_count(darray_t a)

Returns the number of pointers held in a.