Move last node to front in linked list

Write a C function that moves last element to front in a given Singly Linked List. For example, if the given Linked List is 1->2->3->4->5, then the function should change the list to 5->1->2->3->4.

1) Traverse the linked list till last node. 2) Use two pointers – one points to last node and other to second last node. 3) After the end of loop do following operations. i) Make second last as last, set next of it to NULL. ii) Set next of last as root. iii) Make last as root node.