Im having trouble turning this function into a recursion function, partly because I did it another way and now I cant think of how to do it recursively. Can you help?
int list::recursion(int item, int position)
{
node* temp = startPtr;
while(temp != NULL)
{
if(temp->item == item)
return position;
temp = temp->next;
position++;
}
return 0;
}
the function returns the position of an item in a linked list.