Initializacia

This commit is contained in:
Anton 2024-10-29 17:51:58 +01:00
parent 138c5f4e91
commit 647c26db9a
2 changed files with 5 additions and 2 deletions

BIN
a1/main

Binary file not shown.

View File

@ -44,11 +44,14 @@ void check_brackets(const char *line) {
return;
}
} else if (is_closing(ch)) {
if (stack_top >= 0 && stack[stack_top].bracket == matching_bracket(ch)) {
if (stack_top == -1) {
printf("Unexpected closing bracket %c in %d\n", ch, i);
return;
} else if (stack[stack_top].bracket == matching_bracket(ch)) {
stack_top--;
} else {
printf("Crossed bracket %c in %d, expected %c\n", ch, i,
stack_top >= 0 ? matching_bracket(stack[stack_top].bracket) : '#');
matching_bracket(stack[stack_top].bracket));
return;
}
}