I'm having some problems doing the insert function for a linked list.
I have the basic struct
Code:
typedef struct Node
{
Data* data;
struct Node* next;
} No;
And the method to insert:
Code:
void insert (Node* node)
{
Node* tmp, tmpProx;
if (head == NULL)
{
head = node;
}
else
{
for(tmp = head; tmp->next != NULL || calcDist(tmp->next->restaurante) > calcDist(no->restaurante) ; tmp = tmp->next );
// Problem Here!
tmpProx = tmp->next;
tmp->next = node;
node->next = tmpProx;
// End of Problem
}
}
I'm having the error
Code:
error: incompatible types in assignment
Can someone explain me what the problem is please? I'm totally lost