Typedefs | |
typedef struct stack_t | stack_t |
represents a stack. | |
Functions | |
stack creating and destroying functions: | |
stack_t * | stack_new (void) |
creates a stack. | |
void | stack_free (stack_t **) |
destroys a stack. | |
data handling functions: | |
void | stack_push (stack_t *, void *) |
pushes data into a stack. | |
void * | stack_pop (stack_t *) |
pops data from a stack. | |
misc. functions: | |
int | stack_empty (const stack_t *) |
inspects if a stack is empty. |
Header for Stack Library (CDSL).
int stack_empty | ( | const stack_t * | stk | ) |
inspects if a stack is empty.
stack_empty() inspects if a given stack is empty.
Possible exceptions: assert_exceptfail
Unchecked erros: foreign data structure given for stk
[in] | stk | stack to inspect |
1 | empty | |
0 | not empty |
void stack_free | ( | stack_t ** | stk | ) |
destroys a stack.
stack_free() deallocates all storages for a stack and set the pointer passed through stk
to a null pointer. Note that stack_free() does not deallocate any storage for the data in the stack to destroy, which must be done by a user.
Possible exceptions: assert_exceptfail
Unchecked errors: foreign data structure given for stk
[in,out] | stk | pointer to stack to destroy |
stack_t* stack_new | ( | void | ) |
creates a stack.
stack_new() creates a new stack and sets its relevant information to the initial.
Possible exceptions: mem_exceptfail
Unchecked errors: none
void* stack_pop | ( | stack_t * | stk | ) |
pops data from a stack.
stack_pop() pops data from a given stack. If the stack is empty, an exception is raised due to the assertion failure, so popping all data without knowing the number of nodes remained in the stack needs to use stack_empty() to decide when to stop.
Possible exceptions: assert_exceptfail
Unchecked errors: foreign data structure given for stk
[in,out] | stk | stack from which data popped |
void stack_push | ( | stack_t * | stk, | |
void * | data | |||
) |
pushes data into a stack.
stack_push() pushes data into the top of a stack. There is no explicit limit on the maximum number of data that can be pushed into a stack.
Possible exceptions: mem_exceptfail, assert_exceptfail
Unchecked errors: foreign data structure given for stk
[in,out] | stk | stack into which given data pushed |
[in] | data | data to push |