//遍歷棧Status StackTraverse(SqStack S, Status(*Visit(ElemType))){while(S.bottom != S.top){Visit(*--S.top);}return OK;}//visit函數Status Visit(ElemType e){printf("%d\n", e);return OK;}主函數中怎么調用StackTraverse函數,第二個參數應該怎么寫
2 回答

汪汪一只貓
TA貢獻1898條經驗 獲得超8個贊
Status StackTraverse(SqStack S, Status (*pFun)(ElemType))
{
while
(S.bottom != S.top)
{
pFun(*--S.top);
}
return
OK;
}
//visit函數
Status Visit(ElemType e)
{
printf
(
"%d\n"
, e);
return
OK;
}
//調用
StackTraverse(S, Visit);
- 2 回答
- 0 關注
- 227 瀏覽
添加回答
舉報
0/150
提交
取消