program.c

This commit is contained in:
dc254kw 2019-11-29 12:14:45 +01:00
parent f806441c6e
commit bf296751bb

View File

@ -25,7 +25,13 @@
} }
struct node* read_tree(){ 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){ void traverse(struct node* tree){
@ -50,6 +56,6 @@
printf("Pozna %d druhov ovocia a zeleniny.\n",count_fruit(tree)); printf("Pozna %d druhov ovocia a zeleniny.\n",count_fruit(tree));
printf("Odpovedajte 'a' alebo 'n'\n"); printf("Odpovedajte 'a' alebo 'n'\n");
traverse(tree); traverse(tree);
delete_tree(tree); delete_tree(tree);
} }