#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
fsk是什么意思typedef struct Node
{
int data;
struct Node * pNext;
} NODE,* PNODE;
typedef struct Stackhoneycomb
{
PNODE pTop;
PNODE pBottom;
}STACK,*PSTACK;
void init(PSTACK pS);
void push(PSTACK pS, int val);
void traver(PSTACK pS);
int main(void)
{
STACK S;//STACK等价于struct Stack
int val;
init(&S);//初始化
push(&S,1);//进栈
push(&S,2);
traver(&S);
return 0;
}
void init(PSTACK pS)//空栈
{
purple rain
pS->pTop=(PNODE)malloc(sizeof(NODE));
if(NULL==pS->pTop)
{
printf("");
exit(-1);outdated
}
el
{
pS->pBottom=pS->pTop;收获英文
pS->pBottom->pNext=NULL;//pS->pTop->pNext=NULL;
}
}
void push(PSTACK pS, int val)
{
PNODE pNew = (PNODE)malloc(sizeof(NODE));
pNew->data=val;聚能教育
pNew->pNext=pS->pTop;
pS->pTop=pNew;
}zhujie
void traver(PSTACK pS)
{影评作文
PNODE p=pS->pTop;
while(p!=pS->pBottom)
ox什么意思 {
printf("%d ",p->data);
p=p->pNext;
}
}
2013重庆高考作文题目运行结果: