Skip to content

Commit

Permalink
array: implement array_capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Apr 18, 2017
1 parent 915d673 commit e5f3617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e5f3617

Please sign in to comment.