出栈操作Pop(structSqStack*MyStack,ElemType*e)

360U3087550562 |浏览805次
收藏|2019/05/23 09:16

满意回答

2019/05/23 09:44

这个具体要看你栈的结构定义的,如typedef int Element;typedef struct SSqStack //链栈{ Element elem; struct SSqStack *next;} SqStack,*PSqStack;那么,你的出栈可以为int Pop(PSqStack *S, Element *e) //栈顶元素出栈///也可以是int Pop(struct SqStack * MyStack, ElemType *e){ PSqStack p; if(!StackEmpty(*S)) { *e = (*S)->elem; p = *S; *S = (*S)->next; free(p); return 1; } else return 0;}

whoami1978

其他回答(0)
0人关注该问题
+1

 加载中...