Stack Arr
Stack Arr
h>
#include<stdbool.h>
int stack[100],i,j,choice=0,max,top=‐1;
//function declarations
void push();
void pop();
void display();
void peek();
bool isEmpty();
bool isFull();
//Driver code
int main(void)
{
printf("Enter the number of elements in the stack: ");
scanf("%d",&max);
printf("*********Stack Implementation Using Array*********");
printf("\n‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐");
while(choice != 5)
{
printf("\nChose one from the below options...");
printf("\n1.Push");
printf("\n2.Pop");
printf("\n3.Display");
printf("\n4.Peek");
printf("\n5.Exit");
printf("\nEnter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
case 4:
peek();
break;
case 5:
printf("Exiting....");
break;
default:
printf("Invalid Choice...:(\n");
};
}
}