unexpected closing bracket a1

This commit is contained in:
Ivan Leichenko 2024-10-31 18:07:09 +01:00
parent 1833160385
commit a172a9c5d1

View File

@ -35,9 +35,9 @@ int main()
} }
else if (ch == ')' || ch == '}' || ch == ']' || ch == '>') else if (ch == ')' || ch == '}' || ch == ']' || ch == '>')
{ {
if (top == 0) if (top == -1)
{ {
printf("Crossed bracket %c in %d, expected opening bracket\n", ch, i); printf("Unexpected closing bracket %c in %d\n", ch, i);
return 0; return 0;
} }
else if (!isMatchingPair(stack[top], ch)) else if (!isMatchingPair(stack[top], ch))