c - Segmentation Fault when Creating an AVL Tree -



c - Segmentation Fault when Creating an AVL Tree -

i'm attempting create basic avl tree in c , i'm running unusual problem. i've got struct nodes of tree, , struct tree contains pointer root of tree , number of elements has in it. i'm getting seg. fault when seek initialize tree:

struct node{ char *word; int balance; struct node *children[2]; }; struct tree{ struct node *root; size_t numelements; }; struct tree *treecreate(void){ struct tree *t; t->root = null; t->numelements = 0; homecoming t; } int main(int argc, char **argv){ struct tree *t = treecreate(); homecoming 0; }

i can't think of reason problem haven't done pointers yet?

c tree avl-tree

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -