This commit is contained in:
Alina Konoval 2025-10-20 21:24:57 +02:00
parent f20b798616
commit 1dcb4845fd

View File

@ -38,7 +38,7 @@ int main(void) {
if (fgets(code, sizeof(code), stdin) == NULL)
return 0;
// Odstránenie znaku nového riadku, ak existuje
code[strcspn(code, "\n")] = '\0';
printf("Read: %s\n", code);
@ -51,12 +51,12 @@ int main(void) {
stack[++top] = c;
} else if (is_close(c)) {
if (top < 0) {
printf("Unexpected closing bracket %c in %d\n", c, i);
printf("Unexpected closing bracket %c in %d\n ", c, i);
return 0;
}
char last = stack[top--];
if (match(last) != c)
(void)(printf("Crossed bracket %c in %d, expected %c\n", c, i , match(last)), exit(0));
(void)(printf("Crossed bracket %c in %d, expected %c\n ", c, i , match(last)), exit(0));
}
}