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