Need help in - Move last element to front of a given Linked List - GeeksforGeeks

Why do we need to use a double pointer in this?

One pointer is for the second last node in the list, whose next is to be made null. The other pointer is for the last node, which is to be shifted to first, whose next should point to the head and make this node the head.

By double pointer, I meant **head_ref (pointer to pointer).

Sorry. Since the code is changing the head reference from the function, so it’s using double pointer. An example of call-by-reference.

Hey, I solved this one by creating a queue, and then dequeue, enqueue, done.