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;
while (1) {
char *line = read_line();
if (!line) break;
if (!line || line[0] == '\0') break;
if (count == capacity) {
capacity *= 2;
@ -83,7 +83,10 @@ Node *build_tree(char **lines, int *index, int num_lines, int *count, int *error
(*count)++;
} else {
node->yes = build_tree(lines, index, num_lines, count, error);
if (*error) return NULL;
node->no = build_tree(lines, index, num_lines, count, error);
if (*error) return NULL;
}
return node;
}
@ -164,4 +167,4 @@ int main(void) {
}
free(lines);
return 0;
}
}