Im trying to write a binary tree library and this is the only function giving me trouble(so far..)
when i compile, it says:
bintree.c:32: error: void value not ignored as it ought to be
bintree.c:34: error: void value not ignored as it ought to be
will someone please tell me what im doing wrong?Code:typedef struct _bnode{ char *name; struct _node family_node; struct _bnode *left; struct _bnode *right; } BNODE; void tree_insert(char *key, void *value, void *tree){ BNODE *root = (BNODE *)tree; if(root == 0){ root = (BNODE *)malloc(sizeof(BNODE)); root->name = strdup(key); root->left = NULL; root->right = NULL; }else{ if(strcmp(key, root->name) == -1){ root->left = tree_insert(key, value, root->left); <-- line 32 }else if(strcmp(key, root->name) == 1){ root->right = tree_insert(key, value, root->right); <--line 34 }else if(strcmp(key, root->name) == 0){ //do something } } }
thankyou



LinkBack URL
About LinkBacks



