From 1ceee1df1f4a02a139f6f8d6ba04ef69d5d36afc Mon Sep 17 00:00:00 2001 From: InderMangal <80519267+InderMangal@users.noreply.github.com> Date: Sat, 16 Oct 2021 23:57:42 +0530 Subject: [PATCH] Create implement stack using array.c --- Stack/implement stack using array.c | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Stack/implement stack using array.c diff --git a/Stack/implement stack using array.c b/Stack/implement stack using array.c new file mode 100644 index 0000000..9d74835 --- /dev/null +++ b/Stack/implement stack using array.c @@ -0,0 +1,38 @@ +/* +int Stack[SIZE], top = -1; +Above variables are used for Stack, SIZE and top and all are global variables. */ +// Function to check if stack is full. +int isFull() +{ + if(top==SIZE-1) + return 1; + return 0; +} +// Function to check if stack is empty. +int isEmpty() +{ + if(top==-1) + return 0; + return 1; +} +// Function to add an item to stack. +int push(int item) +{ + if(isFull()==0&&top