From bdb10349f2af75105386d06c0f9b4b2b8fa644e7 Mon Sep 17 00:00:00 2001 From: Kozar Date: Sun, 10 Nov 2024 16:02:46 +0000 Subject: [PATCH] Initializacia --- cv7/program.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index ce7a8a8..6261790 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -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; }