From 4dfd9de0ccd1046f894b3f368853fb9553746d7d Mon Sep 17 00:00:00 2001 From: VIliam Date: Thu, 31 Oct 2024 23:31:56 +0100 Subject: [PATCH] s --- a1/program.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/a1/program.c b/a1/program.c index af8cb6e..9e8afe0 100644 --- a/a1/program.c +++ b/a1/program.c @@ -3,7 +3,7 @@ int match(char open, char close) { return (open == '{' && close == '}') || (open == '[' && close == ']') || - (open == '(' && close == ')'); + (open == '(' && close == ')') || (open == '<' && close == '>'); } void check_brackets(const char *code) { @@ -14,9 +14,9 @@ void check_brackets(const char *code) { for (int i = 0; code[i] != '\0'; i++) { char c = code[i]; - if (c == '{' || c == '[' || c == '(') { + if (c == '{' || c == '[' || c == '(' || c == '<') { stack[++top] = c; - } else if (c == '}' || c == ']' || c == ')') { + } else if (c == '}' || c == ']' || c == ')' || c == '>') { if (top == -1) { printf("Unexpected closing bracket %c in %d\n", c, i); return;