diff options
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r-- | collections/vector/vector.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c index b8f83de..0b816b7 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -142,6 +142,16 @@ vec *root; return root->base[--root->end]; } +void* vec_back(root) +vec *root; +{ + if (!root || root->end == 0) { + return NULL; + } + + return root->base[root->end - 1]; +} + void* vec_index(root, index) vec *root; int index; |