Link list reverse

https://ide.codingblocks.com/s/61825
what is wrong with logic

Hi Kiran, you’ve made the members of linklist class as public, but the members of node class are still private. So, when you try to access members of node class, you get an error that you cannot access private members.

https://ide.codingblocks.com/s/61825

https://ide.codingblocks.com/s/61825 This code is showing segmentation fault

Hi Kiran, that is happening because the logic you had used to reverse was not correct. The build function was working correctly. I’ve modified your reverse function slightly, go through it and reply to this thread in case of doubts: https://ide.codingblocks.com/s/62353.

Hi Kiran, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.

kiran firstly k can be greater than n so u have to do k=k%n
2nd as u are using recursion there is no base case thats why ur code is running infinitely.
these are 2 problem .