prg_vector_remove()
Abstract
Removes an element from the specified position in a vector, and shifts elements to fill in the empty space.
Syntax
prg_vector_remove (vector_ptr, pos_index)
| Argument | Type | Description |
|---|---|---|
vector_ptr |
PrgT_Vector * |
the vector of interest |
pos_index |
unsigned long |
the position of the element to be removed |
Return Type
void *
The address of the element that is removed
Header
prg_vector.h
Details
The specified position must be within the bounds of the vector (i.e., it must be greater than or equal to 0 and less than the number of elements in the vector). Otherwise a NIL pointer is returned, and an error may be generated (depending on whether the application has enabled diagnostic error reporting). Given that the position is valid, the elements in higher positions than the removed element are shifted “down” to fill in the created space. Potentially, if the vector has been sufficiently reduced, certain memory resources may be released. The address of the element in the specified position is returned.