Write a program to show the concept of POP operation in Data Structure

#include<stdio.h>
#include<conio.h>
void main()
{
    int a[10],min=0, i, n, tos , item;
    printf("enter no. of elements=");
    scanf("%d",&n);
    printf("enter array elements\n");
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    tos=n;
    if(tos==min)
    {
        printf("underflow");
        exit;
   
    }
    else
        {
        printf("top element is always deleted\n");
    item=a[tos];
    tos=tos-1;
        printf("new stack\n");
        for(i=1;i<=tos;i++)
        {
            printf("%d\n",a[i]);
        }
        }
   
       
        }

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart