LL-Reversal K elements, Runtime error

I’ve just made this code for reversal of first k elements yet the code isn’t running: https://ide.codingblocks.com/s/157367
please check. (I am yet to complete the whole question)

In your code the variable “r” points to node 3 and the next of node 3 is node 4
Now when you reverse the link from node 2 to 3 TO node 3 to 2, Node 3 no more points node 4 but to node 2
Now c and n both point to node 4
Now your while loop never ends because it never finds next of node 3 which is node 2

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.