A69 DS Ass1
A69 DS Ass1
A69 DS Ass1
ROLL NO :- A-69
#include <stdlib.h>
#define SIZE 4
void push();
void pop();
void show();
int main()
int choice;
while (1)
scanf("%d", &choice);
switch (choice)
case 1:
push();
break;
case 2:
pop();
break;
case 3:
show();
break;
case 4:
exit(0);
default:
printf("\nInvalid choice!!");
void push()
int x;
if (top == SIZE - 1)
printf("\nOverflow!!");
else
{
printf("\nEnter the element to be added onto the stack: ");
scanf("%d", &x);
top = top + 1;
inp_array[top] = x;
void pop()
if (top == -1)
printf("\nUnderflow!!");
else
top = top - 1;
void show()
if (top == -1)
printf("\nUnderflow!!");
}
else
printf("%d\n", inp_array[i]);