From 77fcced29eda7dae36d3370dfb19504070d15be3 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Tue, 16 Mar 2021 09:38:55 +0800 Subject: [PATCH] week 3 header file comment --- week3/stack.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/week3/stack.h b/week3/stack.h index 2f8bf9f..244cc5e 100644 --- a/week3/stack.h +++ b/week3/stack.h @@ -1,23 +1,42 @@ +/* + * Author: Walter + * Student ID: 1930006025 + * Week_3 + * Stack + */ + #include +/* struct for stack */ typedef struct Stack_str { + /* the size of stack */ int size; + /* top index, empty is -1 */ int top; + /* data */ double *data; } Stack; +/* create an stack with size */ bool CreateStack(Stack *stack, int size); +/* check a stack whether it contains data */ bool IsEmpty(Stack *stack); +/* check full of stack */ bool IsFull(Stack *stack); +/* get the top value of a stack */ bool Top(Stack *stack, double *x); +/* add a value to stack */ bool Push(Stack *stack, double x); +/* delete a value from stack */ bool Pop(Stack *stack, double *x); +/* print the stack */ void DisplayStack(Stack *stack); +/* delete a stack */ void DestroyStack(Stack *stack);