Aktualizovat cv7/program.c

This commit is contained in:
Weber 2024-11-14 17:30:30 +00:00
parent eecdec6951
commit 17a35e0f35

View File

@ -44,7 +44,7 @@ int read_knowledge_base(char ***lines_ptr, int *num_lines) {
int count = 0; int count = 0;
while (1) { while (1) {
char *line = read_line(); char *line = read_line();
if (!line) break; if (!line || line[0] == '\0') break;
if (count == capacity) { if (count == capacity) {
capacity *= 2; capacity *= 2;
@ -83,7 +83,10 @@ Node *build_tree(char **lines, int *index, int num_lines, int *count, int *error
(*count)++; (*count)++;
} else { } else {
node->yes = build_tree(lines, index, num_lines, count, error); node->yes = build_tree(lines, index, num_lines, count, error);
if (*error) return NULL;
node->no = build_tree(lines, index, num_lines, count, error); node->no = build_tree(lines, index, num_lines, count, error);
if (*error) return NULL;
} }
return node; return node;
} }