You omitted one step in this loop:
Code:
for(int i = 1; i <= 10; i++)
{
current->next = new Node;
current->next->Data = i;
current = current->next; // You went wrong here. You have now dropped your handle on the
// "old" current node without setting the prev pointer of the new node
tail = current->prev; // You don't know where current->prev is pointing.
tail = current;
}
Instead, you should have:
Code:
for(int i = 1; i <= 10; i++)
{
current->next = new Node;
current->next->prev = current; // You NEED this.
current->next->next = NULL; // This would be a good idea too. All pointers should be set
// when the new node is created. Then you can eliminate the
// "current->next = NULL;" line that you had after the end of the loop.
current->next->Data = i;
current = current->next;
tail = current;
}