Posts

Showing posts with the label stack
Image
                                    C-PROGRAM   STACK-push & pop operation #include<stdio.h> void main() { int a[10],it,c,i,fr=0; do { printf("STACK \n 1.PUSH\n2.POP\n3.DISPLAY\nENTER YOUR CHOICE:"); scanf("%d",&c); switch(c) { case 1: if(fr<=9) { printf("enter the element"); scanf("%d",&it); a[fr++]=it; } else printf("stack overflow"); break;      C tutorial video for beginners case 2: if(fr>=0) { printf("the deleted item is %d",a[fr-1]); --fr; } else printf("stack is empty"); break; case 3: for(i=0;i<fr;i++) printf("%d",a[fr]); break; default: printf("invalid operation"); } printf("press 1 to continue"); scanf("%d",&c); }while(c==1); }         ...