You could learn how to add a new node at the end of a list instead of the beginning and save yourself a lot of trouble.
Code:
// Assuming a node like this
struct node {
int content;
node *next;
node(int c, node *n)
{
content = c;
next = n;
}
};
// Add at the front
current = new node(data, front);
front = current;
// Add at the end
if (front != 0)
{
for (current = front; current != 0; current = current->next)
{
if (current->next == 0)
break; // Found the end
}
current->next = new node(data, 0);
}
else
front = new node(data, 0); // Empty list