This commit is contained in:
Džubara 2024-10-31 23:26:55 +01:00
parent f325afdc34
commit 7362504a1f

View File

@ -10,7 +10,7 @@ void check_brackets(const char *code) {
char stack[100]; char stack[100];
int top = -1; int top = -1;
printf("Read: %s\n", code); printf("Read: %s", code);
for (int i = 0; code[i] != '\0'; i++) { for (int i = 0; code[i] != '\0'; i++) {
char c = code[i]; char c = code[i];
@ -29,7 +29,7 @@ void check_brackets(const char *code) {
} }
} }
if (top == -1) { if (top == -1) {
printf("All brackets OK"); printf("All brackets OK\n");
} else { } else {
printf("Unmatched opening bracket %c\n", stack[top]); printf("Unmatched opening bracket %c\n", stack[top]);
} }