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;