From 9aa5bdb7672b174ebb8b11e3783c164fb443fc69 Mon Sep 17 00:00:00 2001 From: ParkMoonJ Date: Fri, 9 Apr 2021 14:41:54 +0800 Subject: [PATCH] Update stack.cpp --- 3 栈和队列/stack.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/3 栈和队列/stack.cpp b/3 栈和队列/stack.cpp index 31bacc9..622b035 100644 --- a/3 栈和队列/stack.cpp +++ b/3 栈和队列/stack.cpp @@ -19,7 +19,11 @@ void ClearStack(Stack &S) { } bool StackEmpty(Stack S) { - return !(S.top + 1); + if (S.top == -1) { + return true; + } else { + return false; + } } int StackLength(Stack S) {