hello everyone,
I'm writing a function traverse for a doubly liked list, I can only use these private members: Node *current , int count, int mutable current_position
and one one private member function void set_position(int position) const
The post condition of member function traverse is the action specified by function *visit has been performed on every entry of the list, begining at position 0 and doing each in turn
void List::traverse(void (*visit)(List_entry &))
{
set_position(0);
while(current!=NULL)
{
(*visit)(current->entry);
current=current->next;
}
}
i tried to reset the position from the current position to 0 then read the next items in the list :rolleyes: , the instructor told me there are two mistakes in this..i really can't figure them out :eek: can anyone please help me?