Tou
Tou header library
Loading...
Searching...
No Matches
Stack

Typedefs

typedef tou_llist_t tou_stack
 Make a stack alias for convenience.
 

Functions

tou_llist_ttou_stack_new ()
 Creates a new stack object.
 
void tou_stack_destroy (tou_llist_t *stack)
 Destroys existing stack object.
 
size_t tou_stack_len (tou_llist_t *stack)
 Returns the length of the stack.
 
void tou_stack_push (tou_llist_t **stack, void *elem)
 Pushes a new element to the top of the stack.
 
void * tou_stack_pop (tou_llist_t **stack)
 Pops an element from the top of the stack.
 

Detailed Description

Function Documentation

◆ tou_stack_destroy()

void tou_stack_destroy ( tou_llist_t * stack)

Destroys existing stack object.

Parameters
[in]stackObject to destroy

◆ tou_stack_len()

size_t tou_stack_len ( tou_llist_t * stack)

Returns the length of the stack.

Parameters
[in]stackStack object
Returns
Stack length

◆ tou_stack_new()

tou_llist_t * tou_stack_new ( )

Creates a new stack object.

Returns
Stack object

◆ tou_stack_pop()

void * tou_stack_pop ( tou_llist_t ** stack)

Pops an element from the top of the stack.

Parameters
[in]stackPointer to the stack object
Returns
Element

◆ tou_stack_push()

void tou_stack_push ( tou_llist_t ** stack,
void * elem )

Pushes a new element to the top of the stack.

Parameters
[in]stackStack object
[in]elemElement to push