This commit is contained in:
Nataliia Kobryn 2025-10-19 23:57:31 +02:00
parent 559203566a
commit 3575505ab5
2 changed files with 5 additions and 1 deletions

BIN
a1/prog

Binary file not shown.

View File

@ -80,7 +80,11 @@ int main() {
} }
char c = input[err - 1]; char c = input[err - 1];
if (c == ')' || c == ']' || c == '}' || c == '>') { if (c == ')' || c == ']' || c == '}' || c == '>') {
printf("Crossed bracket %c in %d, expected %c\n", c, err-1, getExpectedClosing(stack[top])); if (top <-1) {
printf("Unexpected closing bracket %c at position %d\n", c, err-1);
} else {
printf("Crossed bracket %c at position %d, expected %c\n", c, err-1, getExpectedClosing(stack[top]));
}
} else { } else {
printf("Unclosed bracket %c in %d\n", stack[top], err-1); printf("Unclosed bracket %c in %d\n", stack[top], err-1);
} }