feat(stack): added is empty function to stack
This commit is contained in:
parent
b9006ebb0f
commit
47f7db53bb
3 changed files with 7 additions and 1 deletions
|
|
@ -42,6 +42,6 @@ FledastyError fledasty_queue_push(FledastyQueue *current_queue, void *value);
|
|||
void *fledasty_queue_peek(FledastyQueue *current_queue);
|
||||
void *fledasty_queue_pop(FledastyQueue *current_queue);
|
||||
|
||||
static inline size_t fledasty_queue_is_empty(FledastyQueue *current_queue) { return current_queue->size == 0; }
|
||||
static inline size_t fledasty_queue_is_empty(const FledastyQueue *current_queue) { return current_queue->size == 0; }
|
||||
|
||||
#endif
|
||||
|
|
@ -37,4 +37,6 @@ typedef struct {
|
|||
FledastyError fledasty_stack_initialize(FledastyStack *new_stack, const size_t element_byte_size);
|
||||
FledastyError fledasty_stack_destroy(FledastyStack *current_stack);
|
||||
|
||||
static inline size_t fledasty_stack_is_empty(const FledastyStack *current_stack) { return current_stack->size == 0; }
|
||||
|
||||
#endif
|
||||
|
|
@ -48,6 +48,10 @@ int main() {
|
|||
FledastyStack test_stack;
|
||||
fledasty_stack_initialize(&test_stack, sizeof(int));
|
||||
|
||||
if (fledasty_stack_is_empty(&test_stack)) {
|
||||
printf("Stack is empty\n");
|
||||
}
|
||||
|
||||
fledasty_stack_destroy(&test_stack);
|
||||
|
||||
printf("Done\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue