Update a1/program.c

This commit is contained in:
Yurii Chechur 2024-10-24 20:45:24 +00:00
parent 4fde67b65b
commit 04fc1739b8

View File

@ -45,12 +45,12 @@ int main() {
} }
} else if (isClosing(current)) { } else if (isClosing(current)) {
if (top == -1) { if (top == -1) {
printf("Unexpected closing bracket %c at position %d\n", current, i); printf("Unexpected closing bracket %c in %d\n", current, i);
return 0; return 0;
} }
if (!isMatching(stack[top], current)) { if (!isMatching(stack[top], current)) {
char expected = expectedClosing(stack[top]); char expected = expectedClosing(stack[top]);
printf("Crossed bracket '%c' at position %d, expected '%c'\n", current, i, expected); printf("Crossed bracket '%c' in %d, expected '%c'\n", current, i, expected);
return 0; return 0;
} }
top--; top--;