diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-07-02 19:16:19 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-07-04 22:27:59 -0400 |
commit | 98454f841b5ac87d2253c2fae0aba2525853f907 (patch) | |
tree | af9652f3e5f9ad9cf560089c91f12ce39923a17b /collections/vector/vector.c | |
parent | 264857903db99135c8c09d12b3e8af93ac1c7f88 (diff) |
Add pop to vectors
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 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]; +} |