diff --git a/program.c b/program.c index 39a8dc8..8d09136 100644 --- a/program.c +++ b/program.c @@ -25,7 +25,13 @@ } struct node* read_tree(){ - return NULL; + char buffer[SIZE]; + memset(buffer,0,SIZE); + char * r = fgets(buffer,SIZE,stdin); + assert(r); + struct tree* node = calloc(1,sizeof(struct node)); + memcpy(node->value,buffer,SIZE); + return node->value; } void traverse(struct node* tree){ @@ -50,6 +56,6 @@ printf("Pozna %d druhov ovocia a zeleniny.\n",count_fruit(tree)); printf("Odpovedajte 'a' alebo 'n'\n"); - traverse(tree); + traverse(tree); delete_tree(tree); }