Posts

Showing posts with the label Write a Program in c that implement stack and its operations (push and pop) using arrays

Write a Program in c that implement stack and its operations (push and pop) using arrays

/* Write a Program in c that implement stack and its operations (push and pop) using arrays*/   #include<stdio.h> #include<conio.h> int stack[100],choice,n,top,x,i; void push(void); void pop(void); void display(void); int main() {          top=-1;     printf("\n Enter the size of STACK[MAX=100]:");     scanf("%d",&n);     printf("\n\t STACK OPERATIONS USING ARRAY");     printf("\n\t--------------------------------");     printf("\n\t 1.PUSH\n\t 2.POP\n\t 3.DISPLAY\n\t 4.EXIT");     do     {         printf("\n Enter the Choice:");         scanf("%d",&choice);         switch(choice)         {             case 1:             {                 push();                 break;             }             case 2:             {                 pop();                 break;             }             case 3:             {                 display();                 break;             }             case 4: