LibRCG
3.1.1
|
Implementation of a stack as a linked list. More...
Go to the source code of this file.
Data Structures | |
struct | SStackNode |
Stack node structure. More... | |
struct | SStack |
Stack structure. More... | |
Typedefs | |
typedef SStackNode * | StackNode |
Stack node definition. More... | |
typedef SStack * | Stack |
Stack definition. More... | |
Functions | |
Stack | newStack (void) |
Creates a stack. More... | |
void | stackDelete (Stack stack) |
Deletes a stack. More... | |
int | stackPush (Stack stack, void *value) |
Inserts an element at the top of the stack. More... | |
int | stackPop (Stack stack, void **value) |
Removes an elements from the top of a stack. More... | |
int | stackTop (Stack stack, void **value) |
Provides the value of the element at the top of a stack. More... | |
int | stackSize (Stack stack) |
Returns the size of a stack. More... | |
int | stackMap (Stack stack, void(*fun)(void *)) |
Applies a function to the elements of a stack. More... | |
Iterator | stackIterator (Stack stack) |
Creates an iterator from a stack. More... | |
Implementation of a stack as a linked list.
Provides functions to create and manipulate stacks.
Definition in file stack.h.
typedef SStackNode* StackNode |
Stack newStack | ( | void | ) |
void stackDelete | ( | Stack | stack | ) |
int stackMap | ( | Stack | stack, |
void(*)(void *) | fun | ||
) |
int stackPop | ( | Stack | stack, |
void ** | value | ||
) |
Removes an elements from the top of a stack.
Provides the value of the removed element if the value of value
is not NULL
.
stack | the stack |
value | pointer where the removed value should be put (or NULL ) |
int stackPush | ( | Stack | stack, |
void * | value | ||
) |
int stackSize | ( | Stack | stack | ) |
int stackTop | ( | Stack | stack, |
void ** | value | ||
) |
Provides the value of the element at the top of a stack.
If the stack is empty, it will be put the value NULL
at value
.
value
a pointer to the value at the top. Changes to this value will affect the element in the stack.stack | the stack. |
value | pointer where the value at the first position will be put |
LibRCG © 2004-2015 Rui Carlos Gonçalves