From 98454f841b5ac87d2253c2fae0aba2525853f907 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Thu, 2 Jul 2020 19:16:19 -0400 Subject: Add pop to vectors --- collections/vector/vector.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'collections/vector/vector.c') diff --git a/collections/vector/vector.c b/collections/vector/vector.c index 9d895d5..936c0c8 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -86,3 +86,13 @@ int index; return root->base[index]; } + +void* vec_pop(root) +vec *root; +{ + if (!root || root->end == 0) { + return NULL; + } + + return root->base[--root->end]; +} -- cgit v1.1