What is wrong in this code.
I think the problem is because of code at Line 123.
Code: https://ide.codingblocks.com/s/582237
Kth node from end
you have to made 2 changes
-
at line no 119
correct condition will be
while(cnt <= k){
because you are starting k from 1 not from 0 -
in the user_input function()
you have to call insertAtTail()
line no 92 should be corrected
Modified Code
now check
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.