I am not sure if what I am writing is right. My strategy is first getting by the first node of the origin list and by that creating a new list of one node (while making the next node of the origin list to head node), and then by iteratively getting each time the first node and link it to new, reversed list, by being the head of that list. Here is what I have done so far:
typedef struct node {
int data;
struct node *next;
} Node;
void reverseList(Node **head) {
Node *curr = *head; //
Node *new_node = *head;
Node *prev = NULL;
new_node->next = NULL; //the new list is to end with the first node of the origin list//
while (curr != NULL) { //traverse through the whole list//
curr = curr->next;
prev = curr; //getting the next first node//
prev->next = new_node; //and making it linked to the new list//
}
*head = new_node; //the new, reversed list//
}