+ 1

Single linked list get nth node from end

https://code.sololearn.com/c6lZv0Zjpf9c hi friends here is my code ......getting nth node from end i am getting segmentation fault core dumped please find the get_node() function ....please correct

25th Jun 2019, 10:40 AM
malepu rakesh
malepu rakesh - avatar
1 Resposta
+ 2
I think it's inside the if(count >= n) statement, the count = count - n + 1 should be count = count - n, without the + 1
25th Jun 2019, 11:25 AM
Agent_I
Agent_I - avatar