l */
void push(char e)
{ if(s.top-s.base>=s.stacksize)
{ /* apply a new room */
s.base=(char*)realloc(s.base,(s.stacksize+stackincrement)*sizeof(char));
if (!s.base)
exit(1);
s.top=s.base+s.stacksize;
s.stacksize+=stackincrement; }
/* accept the next character */
*s.top++=e;}
/* carry the whole data in the stack into the data section */
char pop()
{ char e;
if(s.top==s.base)
return false;
e=*(--s.top);
return e;}
/* empty the data in the stack */
void clearstack()
{ s.top=s.base; /* let s.top and s.base point to the same place*/}
/*destroy the stack */
void destroystack()
{ free(s.base); /* free the data in the stack */
s.top=s.base;}
/* judge the emputy of the shed */
int stackempty()
{ if (s.top==s.base)
&nbs
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页