帮我看看这个程序,哪错了

来源:百度知道 编辑:UC知道 时间:2024/06/08 17:36:51
#include <stdio.h>
#include <malloc.h>
#include <process.h>
typedef int ElemType
typedef struct linknode
{
ElemType data;
struct linknode *next;
}LiStack;
void InitStack(LiStack *&s)
{
s=(LiStack *)malloc(sizeof(LiStack));
s->next=NULL;
}
void ClearStack(LiStack *&s)
{
LiStack *p=s->next;
while(p!=NULL)
{
free(s);
s=p;
p=p->next
}
free(s);
}
void Push(LiStack *&s,ElemType e)
{
LiStack *p;
p=(LiStack *)malloc(sizeof(LiStack));
p->data=s->next;
s->next=p;
}
int Pop(LiStack *&s, ElemType &e)
{
LiStack *p;
if(s->next==NULL)
return 0;
p=s->next;
e=p->data;
s->next=p->next;
free(p);
return 1;
}
int GetTop(LiStack *s,ElemType &e)
{
if(s->next==NULL)
return 0;

不是提示少一个分号吗?怎么不找一下,试一下是不是这个地方:

void ClearStack(LiStack *&s)
{
LiStack *p=s->next;
while(p!=NULL)
{
free(s);
s=p;
p=p->next ---这里加一个分号: p=p->next;
}

typedef int ElemType
后面少个分号