Initializacia

This commit is contained in:
Kozar 2024-11-10 16:02:46 +00:00
parent 8109d836ab
commit bdb10349f2

View File

@ -20,12 +20,12 @@ struct tree* read_tree() {
return NULL;
}
buffer[strcspn(buffer, "\n")] = 0;
struct tree* node = calloc(1, sizeof(struct tree));
if (buffer[0] == '*') {
if (strlen(buffer) <= 1) {
error_flag = 1;
}
if (buffer[0] == '*' && buffer[1] == ' ') {
error_flag = 1; // Invalid format if there's a space after '*'
}
struct tree* node = calloc(1, sizeof(struct tree));
strncpy(node->value, buffer, SIZE - 1);
return node;
}