Initializacia
This commit is contained in:
parent
d2efa5d900
commit
724940804f
@ -37,18 +37,11 @@ struct tree* load_tree() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (node->value[0] != '*') {
|
||||
if (node->value[0] != '*') {
|
||||
node->left = load_tree();
|
||||
node->right = load_tree();
|
||||
|
||||
if (!node->left || !node->right) {
|
||||
destroy_tree(node);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
struct tree* extra = read_tree();
|
||||
if (extra) {
|
||||
free(extra);
|
||||
if (!node->left || !node->right) {
|
||||
destroy_tree(node);
|
||||
return NULL;
|
||||
}
|
||||
@ -61,7 +54,6 @@ struct tree* load_tree() {
|
||||
|
||||
|
||||
|
||||
|
||||
void run_tree(struct tree* tree) {
|
||||
if (!tree) {
|
||||
return;
|
||||
@ -113,7 +105,7 @@ int main() {
|
||||
struct tree* root = load_tree();
|
||||
printf("Expert z bufetu to vie.\n");
|
||||
|
||||
if (!root) {
|
||||
if (!root) {
|
||||
printf("Chybna databaza\n");
|
||||
return 0;
|
||||
}
|
||||
@ -129,4 +121,3 @@ int main() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user