3
This commit is contained in:
parent
44ede0bb04
commit
f20b798616
11
a1/program.c
11
a1/program.c
@ -38,7 +38,7 @@ int main(void) {
|
|||||||
if (fgets(code, sizeof(code), stdin) == NULL)
|
if (fgets(code, sizeof(code), stdin) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Odstránenie znaku nového riadku, ak existuje
|
||||||
code[strcspn(code, "\n")] = '\0';
|
code[strcspn(code, "\n")] = '\0';
|
||||||
|
|
||||||
printf("Read: %s\n", code);
|
printf("Read: %s\n", code);
|
||||||
@ -60,9 +60,12 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(top >= 0)
|
(top >= 0)
|
||||||
? printf("Missing closing brackets: ", stack[top], (int)strlen(code))
|
? (printf("Missing closing brackets: "),
|
||||||
: printf("All brackets OK\n");
|
({ for (int i = top; i >= 0; i--) printf("%c", match(stack[i])); }),
|
||||||
|
printf("\n"))
|
||||||
|
: printf("All brackets OK\n");
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user