#include<conio.h>
#include<stdio.h>
#include<stdio.h>
void PUSH();
void PEEP();
void POP();
void PEEP();
void POP();
struct node{
int data;
struct node *link;
struct node *link;
}*head,*top=NULL,*newx,*item;
void main()
{
{
int i,size,value;
clrscr();
clrscr();
printf("How many Element want to insert :");
scanf("%d",&size);
for(i=0;i<size;i++)
{
scanf("%d",&size);
for(i=0;i<size;i++)
{
printf("\nEnter Value : ");
scanf("%d",&value);
PUSH(value);
scanf("%d",&value);
PUSH(value);
}
POP();
POP();
POP();
PEEP();
getch();
PEEP();
getch();
}
void PUSH(int value)
{
newx=(struct node*)malloc(sizeof(struct node));
if(newx==NULL)
{
{
clrscr();
printf("\n\t Memory is Full !");
printf("\n\t Memory is Full !");
}
else
{
else
{
newx->data=value;
newx->link=top;
top=newx;
head->link=top;
newx->link=top;
top=newx;
head->link=top;
}
}
void POP()
{
if(top==NULL)
{
{
printf("\nStack is Underflaw");
}
else
{
else
{
item->data=top->data;
head->link=top->link;
top=top->link;
head->link=top->link;
top=top->link;
printf("\nValue %d is POPED OUT ",item->data);
}
}
}
void PEEP()
{
item->data=top->data;
printf("\nTop most Value =>%d",item->data);
printf("\nTop most Value =>%d",item->data);
}
No comments:
Post a Comment