Im working on a Binary Search Tree in C atm, works all fine, nodes are inserted, found, printed etc. BUT, the values they have are not correct. Every node in my tree has a phone number (phone) and a name (name). The phone numbers are not the problem, but the names. For example if I have my root with the number 1 and the name is supposed to be "Mike", it says number=1 and name=1
Same for every other node. Number=Name. Why? I guess it has something to do with the value being a string and not an int, right? The important part in my code would be the following then:
void bst_insert_node(bstree* bst, unsigned long phone, char *name) {
bst_node* tmp=bst->root;
bst_node* tmp2;
bst_node* new_node=(bst_node*)malloc(sizeof(bst_node));
new_node->phone=phone;
new_node->name=name; // THIS LINE
new_node->left=new_node->right=NULL;
What would I have to change? I tried several things now, but nothing worked..