Runtime error in my code

https://ide.codingblocks.com/s/151835 The code is showing runtime error. I am unable to debug it

Hello @tanjuljain19,
There are a lot of mistakes in your code.
First check your input format. You will always skip the first digit in this approach. Also, you need to pass the head of the linked list to the getK function. Also, your getK function is incorrect. I suggest you to make a count variable in the input while loop and count the number of elements.

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.