Question: I need to implement a function that reverses a linked list but i don't know how to return a newly formed linked list as a result.

```
typedef struct node_t* Node;

struct node_t {
    int n;
    Node next;
};    

// create a new node with value n
Node nodeCreate(int n) 
{
    Node node = malloc(sizeof(*node));
    if (node == NULL) return NULL;

    node->n = n;
    node->next = NULL;

    return node;
} 

// reversing the linked list
Node reverseList(Node list) 
{
    if (list == NULL) return NULL;

    Node current, prev, next;
    current = rev_head;
    prev = NULL;

    while( current != NULL)
    {
        next = current->next;
        current->next = prev;
        prev = current;
        current = next;
    }

    list = prev;
    return list;
}

```

This is the code I have written so far.

How do I insert this reverse linked list into a different new linked list within the function `reverseList` it self?

Answer: 
You can simply create a new node for every node in the original list and set the link in opposite order. Code could be:

```
Node createReversedList(Node node) {
    Node result = NULL;
    while (node != NULL) {
        Node n = nodeCreate(node->n);
        n->next = result;
        result = n;
        node = node->next;
    }
    return result;
}

```
There is a simple way in which you can reverse linked list

You can simply create a new linked list and add each node at the start of linked list which will create same linked list in reverse order

```
Node* revList(Node *start){
Node *startRev=NULL,*temp,*newNode;
temp = start;
while (temp->next!=NULL){
    newNode = (Node *) malloc (sizeof(Node));
    //Code for copying data from temp to new node

    if(startRev == NULL){
        startRev = newNode;
    }
    else {
        newNode->next = startRev;
        startRev = newNode;
    }
    temp = temp->next;
}
return startRev;
}

```