This commit is contained in:
Bohdan Kapliuk 2024-11-11 14:45:58 +02:00
parent 190e67862e
commit 2adc3595d9

View File

@ -1,7 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h>
#define SIZE 100 #define SIZE 100
@ -18,11 +17,9 @@ struct tree* read_tree(int* counter) {
if (buffer[0] == '\n') { if (buffer[0] == '\n') {
return NULL; return NULL;
} }
assert(r);
struct tree* tree = calloc(1, sizeof(struct tree)); struct tree* tree = calloc(1, sizeof(struct tree));
tree->value = malloc(strlen(buffer) + 1); tree->value = malloc(strlen(buffer) + 1);
strcpy(tree->value, buffer); strcpy(tree->value, buffer);
assert(tree->value);
if (buffer[0] == '*') { if (buffer[0] == '*') {
(*counter)++; (*counter)++;
return tree; return tree;