data_structures
|
Go to the source code of this file.
Typedefs | |
typedef t_array | t_stack |
A last-in-first-out stack of generic items. More... | |
Functions | |
void | stack_push (t_stack *stack, const void *data) |
Copy the item and add it to the stack. More... | |
void * | stack_pop (t_stack *stack) |
Removed and returns the item most recently added to this stack. More... | |
void * | stack_peek (const t_stack *stack) |
Returns the item most recently added to this stack, without removing it. More... | |
void | stack_delete (t_stack *stack) |
Deletes the stack and frees memory taken by its contents. More... | |
size_t | stack_size (const t_stack *stack) |
Returns the number of items in this stack. More... | |
t_stack * | stack_new (const t_type *type) |
Initializes an empty stack. More... | |
t_stack * | stack_copy (const t_stack *stack) |
Copies a stack and all it contents. More... | |
Copies a stack and all it contents.
Definition at line 16 of file stack_copy.c.
void stack_delete | ( | t_stack * | stack | ) |
Deletes the stack and frees memory taken by its contents.
Definition at line 16 of file stack_delete.c.
Initializes an empty stack.
type | the type of items that this stack will hold |
Definition at line 16 of file stack_new.c.
void* stack_peek | ( | const t_stack * | stack | ) |
Returns the item most recently added to this stack, without removing it.
NULL
if the stack is empty. Definition at line 16 of file stack_peek.c.
void* stack_pop | ( | t_stack * | stack | ) |
Removed and returns the item most recently added to this stack.
NULL
if the stack is empty. Definition at line 16 of file stack_pop.c.
void stack_push | ( | t_stack * | stack, |
const void * | data | ||
) |
Copy the item and add it to the stack.
data | The item to be added |
Definition at line 16 of file stack_push.c.
size_t stack_size | ( | const t_stack * | stack | ) |
Returns the number of items in this stack.
Definition at line 16 of file stack_size.c.