C_Algorithms 2.0.0
Documentation
Loading...
Searching...
No Matches
stack.h
Go to the documentation of this file.
1#ifndef STACK_H
2#define STACK_H
3
4#include <stdint.h>
5#include <math.h>
6#include <stdbool.h>
7
8
9typedef float stack_value_t;
10#define STACK_NO_VALUE (stack_value_t)INFINITY
11
12typedef struct stack
13{
14 uint32_t size;
15 uint32_t capacity;
18
19
20mystack_t *CreateStack(uint32_t capacity);
21
23
25
27
29
31
33
35
36void Stack();
37
38#endif //STACK_H
stack_value_t TopStack(mystack_t *stack)
Return the top object of the stack.
Definition stack.c:117
void PrintStack(mystack_t *stack)
Print the whole stack.
Definition stack.c:129
bool StackIsFull(mystack_t *stack)
Check if the Stack object is full.
Definition stack.c:75
mystack_t * CreateStack(uint32_t capacity)
Create a Stack object.
Definition stack.c:14
bool StackIsEmpty(mystack_t *stack)
Check if the Stack object is empty.
Definition stack.c:63
void Stack()
Definition stack.c:148
mystack_t * FreeStack(mystack_t *stack)
Free the memory of a given Stack object.
Definition stack.c:43
void PushStack(mystack_t *stack, stack_value_t value)
Push a new object to the stack.
Definition stack.c:85
float stack_value_t
Definition stack.h:9
stack_value_t PopStack(mystack_t *stack)
Pop the object on top of the stack.
Definition stack.c:102
struct stack mystack_t
Definition stack.h:13
uint32_t capacity
Definition stack.h:15
uint32_t size
Definition stack.h:14
stack_value_t * data
Definition stack.h:16