From a172a9c5d1dbcfebf2cc98fdc06f6bbbe604d841 Mon Sep 17 00:00:00 2001 From: Ivan Leichenko Date: Thu, 31 Oct 2024 18:07:09 +0100 Subject: [PATCH] unexpected closing bracket a1 --- a1/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/a1/program.c b/a1/program.c index c8bb8ea..3f29499 100644 --- a/a1/program.c +++ b/a1/program.c @@ -35,9 +35,9 @@ int main() } else if (ch == ')' || ch == '}' || ch == ']' || ch == '>') { - if (top == 0) + if (top == -1) { - printf("Crossed bracket %c in %d, expected opening bracket\n", ch, i); + printf("Unexpected closing bracket %c in %d\n", ch, i); return 0; } else if (!isMatchingPair(stack[top], ch))