Initial implementation of stack docs.
This commit is contained in:
parent
79d4d051a8
commit
112034e44e
|
@ -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
|
Loading…
Reference in New Issue