I am trying to insert values from the binary search tree to linkedlist.
- insertToLinkedList , I am using this method. But there is a problem with assigning.
- struct node
- struct nodeForLinkedList
struct node
{// Here node struct for leafs of the Tree
char word[STRING_LEN]; //words
struct node *left;
struct node *right;
};
struct nodeForLinkedList
{
char word[STRING_LEN]; //words
struct node *left;
struct node *right;
struct node *next;
}
void insertToLinkedList(nodeForLinkedList *nodeL,char *data){
struct nodeForLinkedList* new_node = (struct nodeForLinkedList*)malloc(sizeof(struct nodeForLinkedList));
strcpy(new_node->word, data); // To copy the elements of data to new node's word
new_node->next = *nodeL; // Error occurs here.**(1)**
*nodeL = new_node;// and here**(2)**
}
Errors:
no suitable conversion function from "nodeForLinkedList" to "node *" existsC/C++(413) (1)
no operator "=" matches these operands -- operand types are: nodeForLinkedList = nodeForLinkedList (2)