Depth-Studios
Welcome guest (Login / Register)
get vector size

Definition


size_t get_vector_size(vector_t *vector);


Description


Get the number of elements in the vector


Parameters


vector
Vector from which to retrieve the size of.


Return Value


Current size of vector.


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("size: %i\n", get_vector_size(vector));
 
	destroy_vector(vector);
 
	return 0;
}


Output:
size: 3