About | Features | Requirements | Starting | Build | Author
Implementation of stack container in C.
Type support:
| Type | Supported |
|---|---|
int |
Yes |
double |
Yes |
char |
Yes |
Separate headers for each type:
#include "c_stack_int.h"
#include "c_stack_double.h"
#include "c_stack_char.h"Macros of dynamic type functions call:
// Requiers c_stack header
#include "c_stack.h"| Macros | Description |
|---|---|
| st_init(type, size, stack_ptr) | Initialize stack |
| st_empty(type, stack_ptr) | Check if stack length = 0 |
| st_pop(type, stack_ptr) | Remove last value of stack |
| st_push(type, stack_ptr, value) | Add new value on the end of stack |
| st_remove(type, stack_ptr) | Free memory allocated to stack |
| st_size(type, stack_ptr) | Get stack length |
| st_top(type, stack_ptr) | Get pointer of last value of stack |
| st_valid(type, stack_ptr) | Check if stack fields is valid |
Before starting, you need to have Git and Brew installed.
# Clone this project
$ git clone https://github.com/DisonGo/c_stack
# Access
$ cd c_stack
# Move to source folder
$ cd src# Build static lib c_stack.a in ../build dir
$ make
# Or
$ make all
# Or
$ make c_stack.a
# Build lib with debug
$ make clean debug c_stack.a
# Build and run tests
$ make test
# Create and open code coverage report
$ make gcov_report
# (Optional)
# Create your own main.c in src dir
# Build main.c in ./src (exe name ./c_stack)
$ make mainMade by Godison