I have a question about the list chained in C. The exercise is a function that receives as a parameter the initial node of the linked list and the position x (counting backwards). With this, I have to go through and find the position, return the value of the corresponding node.
I've done this so far:
struct Node
{
int data;
struct Node *next;
}
/*-------------------------------------------------*/
int GetNode(Node *head,int positionFromTail)
{
struct Node* fimNodo;
while(head->next!=NULL){
head->next=next;
if(head->next==NULL){
fimNodo->data=head->data;
fimNodo->next=head->next;
}
}
while(positionFromTail!=0){
fimNodo->next=*next;
positionFromTail--;
if(positionFromTail==0){
return fimNodo->data;
}
}
}
You are giving this feature an error. can anybody help me?
Note: Exercise is just this function and does not require the main function ...
The errors that are occurring are:
cannot resolve overloaded function ‘next’ based on conversion to type ‘Node*’
cannot convert ‘Node’ to ‘Node*’ in assignment