C语言表达式求值程序和程序注释

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:33:08

#include<stdio.h>
#include<malloc.h>
#define null 0
#define max 100typedef struct date /*定义字符栈*/
{ char sk[max];
int top;}
seqstack;typedef struct da /*定义数据栈*/
{ int sk[max];
int top;}
stack;void push(seqstack *s,char x) /*进栈*/
{
if(s->top==max-1)
{ printf("out of space.\n"); }
s->top++;
s->sk[s->top]=x;}
void spush(stack *s,int x) /*进栈*/
{ if(s->top==max-1)
{ printf("sout of space.\n"); }
s->top++;
s->sk[s->top]=x;}
char pop(seqstack *s ,char c) /*出栈*/
{ if(s->top==-1)
{ printf("no element.\n");
return 0; }
else
{ c=s->sk[s->top];
s->top--;
return c; }}
int spop(stack *s ,int c) /*出栈*/
{ if(s->top==-1)
{ printf("sno e