Doubt in Recursive call

I did not understood the line 45-47
head->next = reverseK(n,k);

why are we using head->next ?
head of next will be the next node after head. We are also not updating the head. So head->next will be 2nd element…
and why are we returning prev pointer?

the link of code :

@sanjit_15
You are reversing the list in steps
So when you reverse the next K elements after an element its head is changed and you need to point to it that’s why line 45-47
prev pointer points to the head in the next K elements so you need to return to it update head of element which called ReverseK

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.