I have a doubt in the following code,
i have a function as follows,
void deleteNode(struct myList ** root)
{
struct myList *temp;
temp = *root;
...//some conditions here
*root = *root->link; //this line gives an error
*root = temp->link; //this doesnt give any error
}
so what is the difference between the two lines, for me it looks the same..
The error is,
error #2112: Left operand of '->' has incompatible type 'struct myList * *'
Thank you 🙂
The problem here is that the “->” operator is binding more tightly than the “*” operator. So your first statement:
is evaluating to:
rather than:
Since root is a pointer to a pointer, the -> operator doesn’t make any sense on it, hence the error message.