STACK USING ARRAY by smd
STACK USING ARRAY #include <stdio.h> int stack[100],top=-1,n,i,choice = 0; void push(); void pop(); void peek(); void display(); void main() { printf("Enter no of elements which you want to insert\n"); scanf("%d",&n); while (choice!=5) { printf(" Choose the option below \n"); printf("1.push\n2.pop\n3.peek\n4.display\n5.exit\n"); scanf("%d",&choice); switch(choice) { case 1: push(); break; case 2: pop(); break; case 3: peek(); break; case 4: display(); break; case 5: printf("Exiting.....\n"); break; default: printf("invalid entry\n"); break; } } } void push() { if(top>=n-1) { printf("stack is overflow \n"); } else { int x; printf("enter the x value\n"); scanf("%d",&x); top++; stack[top]=x; } } void pop() { if(top ==-1) { ...