hi, this is part of my code and i have to use struct... but my add_back
crashes after i input the second new node. (in the else section) i don't
understand what's wrong.
thanks for helping
struct node
{
int data;
node *next;
};
node add_back(node *&list, int info)
{
node *skip;
if (list == NULL)
{
node *tail = new node;
tail -> data = info;
tail -> next = NULL;
list = tail;
skip = tail;
}
else
{
node *tail = new node;
tail -> data = info;
tail -> next = NULL;
skip -> next = tail;
skip = skip -> next;
}
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|