// 置空栈 LinkStack Init_LinkStack() { return NULL; } //判栈空 int Empty_LinkStack ( LinkStack top ) { if ( top==-1 ) return 1; else return 0; } //入栈 LinkStack Push_LinkStack ( LinkStack top, datatype x ) { StackNode *s; s=malloc ( sizeof ( StackNode ) ); s->data=x; s->next=top; top=s; return top; } //出栈 LinkStack Pop_LinkStack ( LinkStack top, datatype *x ) { StackNode *p; if ( top= =NULL ) return NULL; else { *x = top->data; p = top; top = top->next; free ( p ); return top; } }