The array data structure is a simple array implementation. Each array has a size and capacity. The array indices range from zero to the array’s size minus one. You can put any kind of data into this array which fits into the size of a pointer. The array grows automatically if necessary.
Create a new array with the initial capacity capacity and return
a pointer to it. If capacity is zero it defaults to some value.
If destroy is non-
that function (typically used to free dynamically allocated memory).
For example, if the array contains data allocated by
destroy should be specified as
svz_free. If the array
contains data which should not be released, destroy should
Completely destroy the array array. The array handle is invalid afterwards. The routine runs the destroy callback for each element of the array.
Return the array element at the position index of the array
array if the index is within the array range. Return
Replace the array element at the position index of the array
array with the value value and return the previous value
at this index. Return
NULL and do nothing
if array is
NULL or the index is out of the array
Append the value value at the end of the array array.
Do nothing if array is
Remove the array element at the position index of the array
array. Return its previous value or
NULL if the index
is out of the array’s range.
Return the current size of array.
Expand into a
for-statement header, for iterating over
array. On each cycle, value is assigned to successive
elements of array, and i the element’s position.