---
# System prepended metadata

title: 12575 - Reverse Linked List ver 2 - easy
tags: [linked list]

---

# 12575 - Reverse Linked List ver 2 - easy
>author: Utin
###### tags: `linked list`

---

## Brief
See the code below

## Solution 0

```c=
#ifndef _FUNCTION_H_
#define _FUNCTION_H_

#include <stdio.h>
#include <stdlib.h>

typedef struct _Node{
    int data;
    struct _Node* next;
} Node;

void Reverse_List(Node** ptr_head) {
    if (*ptr_head != NULL) {
        Node* pre_curr = NULL;
        Node* curr = *ptr_head;
        Node* next_curr = curr->next;
        while (curr != NULL) {
            curr->next = pre_curr;
            pre_curr = curr;
            curr = next_curr;
            if (next_curr != NULL) next_curr = next_curr->next;
        }
        *ptr_head = pre_curr;
    }
}

#endif
// By Utin
```

## Reference