appending one linked list after another.

Apr 14, 2012 at 7:38am
Write an Append() function that takes two lists, 'a' and 'b', appends 'b' onto the end of 'a', and then sets 'b' to NULL (since it is now trailing off the end of 'a').

void Append(struct node** aRef, struct node** bRef) {
/* Your code...*/
}


please suggest me how to do this problem. i have thought but didn't get any idea.
Apr 14, 2012 at 11:50am
Do you know how to insert an node at the end? This is the same, but instead of a new node you'll be inserting the head of b.
Apr 14, 2012 at 12:51pm
When playing with pointers (and linked lists), you should always get out some paper and a pencil and draw what you have, then modify the drawing to show what you want to have happen, and make your code do the same thing you had to do with your pencil and eraser.
Topic archived. No new replies allowed.