struct Stack
{
int Data;
struct Stack *next;
}*top;
void popStack()
{
struct Stack *temp = top;
if(temp == NULL)
printf("\nStack Empty")
else{
top = top->next;
free(temp);
}
}
void pushStack(int value)
{
struct Stack *temp;
temp=(struct Stack *)malloc(sizeof(Stack Node));
temp->Data=value;
if (top == NULL)
{
top=temp;
top->next=NULL;
}
else
{
temp->next=top;
top=temp;
}
}
void display()
{
struct Stack *var=top;
if(var == NULL)
printf("Stack is Empty");
else
{
while(var!=NULL) {
printf("%d \n",var->Data);
var=var->next;
}
}
}