Here I want to present you my Stack
- Download the Source and Include directories
- Delete the "main.cpp" file
- Include the "stack.h" in your program
- Download all
- Edit the "main.cpp" as you want, the stack itsef in the "stack.h"
- Open the terminal, use commands "make clean" to clean the objects, "make" to build the project and "make run" to run your program
type name: Stack
For init:
StackError StackCtor (Stack *src, size_t length, size_t elsize, char toxicvalue, void (*FprintFunc)(FILE* flog, void* elem));
!!Don't forget FprintFunc, which is for logging your stack For usage:
StackError StackPush (Stack *src, void *elem);
StackError StackPop (Stack *src, void *elem);
To turn off the debug function use:
>#define NOOOOOOOOOOOOOO
or >to off only canaries:
#define NOCANS
or to off only hash
#define NOHASH
to check and dump in debug mode
STACK_ASSERT(Stack *stack)
DUMP(Stack *stack)
set the log file (which is
stderr
by default) by:
void SetLog(const char* filename);