level 1
老三挺2
楼主
void Initstack(lnearstack *p) /*栈的初始化*/
{
p->top=-1;
}
int Isempty(lnearstack *p) /*判断空*/
{
return(p->top==-1?1:0);
}
int Isfull(lnearstack *p) /*判断满*/
{
return(p->top==stack_size-1?1:0);
}
int push(lnearstack *p,char x) /*进栈操作*/
{
if(p->top==stack_size-1) return(0);
p->top++;
p->a[p->top]=x;
return(1);
}
int pop(lnearstack *p,char *x) /*出栈操作*/
{
if(p->top==-1)
return(0);
else
{
*x=p->a[p->top];
p->top--;
return(1);
}
}
int gettop(lnearstack *p,char *x) /*取栈顶元素*/
{
if(p->top==-1)
return(0);
else
{
*x=p->a[p->top];
return(1);
}
}
int match(char a,char b)
{
int w;
w=((a==41&&b==40?1:0)||(a==93&&b==91?1:0)||(a==125&&b==123?1:0));
return(w);
}
2012年10月28日 06点10分
1
{
p->top=-1;
}
int Isempty(lnearstack *p) /*判断空*/
{
return(p->top==-1?1:0);
}
int Isfull(lnearstack *p) /*判断满*/
{
return(p->top==stack_size-1?1:0);
}
int push(lnearstack *p,char x) /*进栈操作*/
{
if(p->top==stack_size-1) return(0);
p->top++;
p->a[p->top]=x;
return(1);
}
int pop(lnearstack *p,char *x) /*出栈操作*/
{
if(p->top==-1)
return(0);
else
{
*x=p->a[p->top];
p->top--;
return(1);
}
}
int gettop(lnearstack *p,char *x) /*取栈顶元素*/
{
if(p->top==-1)
return(0);
else
{
*x=p->a[p->top];
return(1);
}
}
int match(char a,char b)
{
int w;
w=((a==41&&b==40?1:0)||(a==93&&b==91?1:0)||(a==125&&b==123?1:0));
return(w);
}