A stack is an ordered list in which insertions (pushes) and deletions (pops) are made at one end called the top.
PUSH Function for stack using Array
void push(int element)
{
if (top == MAX - 1)
{
printf("Stack Overflow\n");
}
else
{
top++;
stack[top] = element;
printf("Element pushed: %d\n", element);
}
}POP Function for stack using Array
int pop()
{
if (top == -1)
{
printf("Stack Underflow\n");
return -1;
}
else
{
return stack[top--];
}
}