#include<stdio.h>
#include<stdlib.h>
typedef struct S_NODE {
struct S_NODE *down;
int value;
}S_Node;
S_Node* S_Init_HE()//生成头尾节点
{
S_Node *phead, *pend;
phead = (S_Node*)malloc(sizeof(S_NODE));
pend = (S_Node*)malloc(sizeof(S_NODE));
phead->down = pend;
pend->down = NULL;
return(phead);
}
S_Node* S_Init_N(int Value)//生成节点
{
S_Node *pnow;
pnow = (S_Node*)malloc(sizeof(S_NODE));
pnow->value = Value;
pnow->down = NULL;
return(pnow);
}
S_Node* S_Input(S_Node *pnew, S_Node *Stack)//插入
{
pnew->down = Stack->down;
Stack->down = pnew;
return(Stack);
}
int S_IfEmpty(S_Node *phead)//是否为空
{
if (phead->down->down == NULL)
{
return(0);
}
return(1);
}
int S_Output(S_Node *phead)//输出
{
int Value;
S_Node *ptemp;
Value = phead->down->value;
ptemp = phead->down;
phead->down = phead->down->down;
free(ptemp);
return(Value);
}