1
0
Fork 0

Initial implementation of stack docs.

This commit is contained in:
wael 2021-09-09 21:54:34 +03:00
parent 79d4d051a8
commit 112034e44e
1 changed files with 48 additions and 0 deletions

48
docs/stack/stack.h.ms Normal file
View File

@ -0,0 +1,48 @@
.DA
.TL
stack.h
.AU
Wael Karram
.AB no
Documentation for stack.h
.AE
.ND
.PP
This header defines a stack (FIFO), with the prepoccessor variable STACK_H used as an include guard.
.br
Defines a single struct
.UL stack_t \0which
has the fields
.I "int size" \0and
.I "node_t *head" ,
the former of which refers to the stack's size, and the latter of which refers to the stack's head.
.PP
This header also includes the following headers:
.br
.I "stdlib.h" ,
.I "../nodes/single_node.h" .
.PP
This header defines the following constants:
.br
.I "INITIAL_STACK_SIZE" sets the initial stack size to 0.
.br
.I "PUSH_SUCCESS" sets the success code for a push to 1.
.br
.I "PUSH_FAIL" sets the failure code for a push to 0.
.br
.I "INVALID_SIZE" returned on invalid size given, evaluates to -1.
.PP
Function definitions, input and expected behavior:
.br
stack_t* initialize_stack() - This function initializes a new empty stack, returns NULL on failure.
.br
node_t* pop(stack_t *stack) - Pops the head of the stack, returns NULL on empty or NULL stack.
.br