Please I Need help in retrieving the value of the node of its given position
here's my code, but there's is a problem in returning the value . .
Code:int n=1;
Node *newNode=head;
while(newNode->next!=NULL)
{
if(newNode->data==location) {
newNode=newNode->next;
n++;
} else {
break;
}
}
return newNode->data;