POP:
ALGORITHM:
step1: check the for the stack underflow
if TOP<0
{
Then print "Stack is empty and exit"
}
else
{
Remove the data from the top of the stack
}
step2:[delete an item from the top position of the stack]
set STACK[TOP] = TOP;
step3:[Decrement the pointer]
set TOP = TOP-1;
PROGRAM:
{
int item;
if(TOP == -1)
{
printf("The stack is empty");
getch();
exit(0);
}
else
{
item=STACK[TOP];
TOP=TOP-1;
}
return(item);
}
Its nice and Good technical Info
ReplyDelete