Kth node from end in a linked list

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

I have created a function a function for this.
Please check if it is correct or not and rectify it please!

Hey Preesh, the logic you have coded is correct. It should work fine. If it is giving some error then please post your whole code.

No sir, no error.
All I want to know is do I need to add any other function apart from printNthFromLast or just the main() function?

Hey Preesh, you need to add other basic things also, Node class, buildlist(), printlist().