Linked list problem- sorting

why are we using node* sort instead of void ?

@mikkyimran After sorting the linked list, the root node may change, and by that function we are returning the new root node. So return data type is node*

Hey @mikkyimran! Suppose we have a list initally 5->4-.>3->2->1 and after sorting it becomes 1->2->3->4->5 so if our function is void we will lose track of the new head so we have to return it from the function. Kindly resolve this question and rate if you liked the response!