Programming Solutions
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:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment