aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--array.c4
-rw-r--r--array.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/array.c b/array.c
index aa43151..46ea9e0 100644
--- a/array.c
+++ b/array.c
@@ -123,3 +123,7 @@ bool array_remove(Array *arr, size_t idx) {
size_t array_length(Array *arr) {
return arr->len;
}
+
+size_t array_capacity(Array *arr) {
+ return arr->count;
+}
diff --git a/array.h b/array.h
index bee8725..21036a9 100644
--- a/array.h
+++ b/array.h
@@ -54,5 +54,7 @@ bool array_add_ptr(Array*, void *item);
bool array_remove(Array*, size_t idx);
/* return the number of elements currently stored in the array */
size_t array_length(Array*);
+/* return the number of elements which can be stored without enlarging the array */
+size_t array_capacity(Array*);
#endif