Cannot figure out the problem with my earlier code

I am getting a run-time error with my previous approach of the same question. I spent quite a time trying to figure out the problem but it seems I am missing something.

The function ReverseList returns the last element after reversing the k elements in the main function. I try to connect this with the farHead2 node pointer which is the pointer which should get linked after the complete process. For eg if k=3 and n=9, in first iteration farHead1 points at 4th element and farHead2 points at 6th element;

My code: https://ide.codingblocks.com/s/99415

Your code is passing all test cases. Wht problem then are you facing ?

I passed the test cases using a different approach/code. I was not able to figure out the problem with my earlier code (which the given ide coding blocks refers to). I gave it more time today and it seems I have figured out the problem with my earlier code. Thanks for responding btw.