howm
More...
Go to the source code of this file.
|
struct | stack |
| Represents a stack. This stack is going to hold linked lists of clients. An example of the stack is below: More...
|
|
howm
- Author
- Harvey Hunt
- Date
- 2015
void stack_free |
( |
struct stack * |
s | ) |
|
Free the allocated contents.
- Parameters
-
s | The stack that needs to have its contents freed. |
void stack_init |
( |
struct stack * |
s | ) |
|
Dynamically allocate space for the contents of the stack.
We don't know how big the stack will be when the struct is defined, so we need to allocate it dynamically.
- Parameters
-
s | The stack that needs to have its contents allocated. |
Remove the top item from the stack and return it.
- Parameters
-
s | The stack to be popped from. |
- Returns
- The client that was at the top of the stack. It acts as the head of the linked list of clients.
Pushes a client onto the stack, as long as it isn't full.
- Parameters
-
s | The stack. |
c | The client to be pushed on. This client is treated as the head of a linked list. |