Monday, 28 November 2016

Copy constructor singly linkedlist

Working copy constructor for singly linked list




linkedlist::linkedlist(const linkedlist &l)
{
first=NULL;
if (l.first!=NULL)

{
Node *ptr=l.first;

while (ptr!=NULL)
{


append(ptr->data);
ptr=ptr->next;
}
}
}

No comments: