prg_vector_find()
Abstract
Locates an element in a vector based on the element's address, and returns the element’s position.
Syntax
prg_vector_find (vector_ptr, element_ptr, found_ptr)
| Argument | Type | Description |
|---|---|---|
vector_ptr |
PrgT_Vector * |
vector of interest |
element_ptr |
void * |
address of element to be located |
found_ptr |
int * |
result of the find operation: PRGC_TRUE if the search succeeded, PRGC_FALSE otherwise. |
Return Type
unsigned long
zero-indexed position of the element within the vector. This return value is meaningful only if the value of &found_ptr is TRUE.
Header
prg_vector.h
Details
Searches through the elements of the vector (note the performance implications of calling this function). If an element with the specified address is found, its position index in the vector is returned. This function allows the vector to be “contents-addressable”.
The return value is zero-indexed. If this procedure does not find the element, it returns a meaningless value; for this reason, you should always check the value of &found_ptr before using the return value.