get vector
Definition
void *get_vector(vector_t *vector, size_t position);
Description
Get the element at the requested position
Parameters
- vector
- Vector from which to retrieve the element from.
- position
- Index of the position.
Return Value
The object located at the specified position.
Example
#include <stdio.h> #include <libc/string.h> int main(int argc, char *argv[]) { vector_t *vector = create_vector(); push_vector(vector, (void *)10); push_vector(vector, (void *)15); push_vector(vector, (void *)20); printf("Element at 1:%i\n", get_vector(vector, 1)); destroy_vector(vector); return 0; }
Output:
Element at 1:15