4
This commit is contained in:
parent
f20b798616
commit
1dcb4845fd
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user