> For the complete documentation index, see [llms.txt](https://nitinranganath.gitbook.io/data-structures/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nitinranganath.gitbook.io/data-structures/linked-list/concatenating-two-lists.md).

# Concatenating Two Lists

### Procedure :

* Take the head pointer of both linked lists as parameters.
* Traverse to the last node of first list.
* Make the next point to the first of second list.

```c
void concatenate(struct node *first, *second) (

    // Traversing to the last node of first list
    while (first -> next != NULL) {
        first = first -> next;
    }
    // Setting the next as first node of second list
    first -> next = second;
    
}
```

Contributed by Nitin Ranganath
