C Collections

cvector · Section 3

cvector_at

cvector_at - access an element at a specific index

C Collections (libccollections, -lccollections)

#include <ccollections/cvector.h>
 
void *cvector_at(cvec v, size_t index);

Gives a pointer to the element at the given index, through which the
caller can read the element or change it in place.

v      Vector to access
index  Zero-based index of the element to access

A pointer to the element at the index on success.
NULL when index >= elem_count, and when the vector is empty.

O(1). The pointer is valid only until the size of the vector changes. The
function asserts when v is NULL.

cvec_at(3), cvector_size(3)