Kth element from last in link list

it is giving segmentation error in 2nd while loop in main function

Can you pls tell wht exactly you are doing in your code… I m not able to understand it well the approach you are using in your code…

Hi bro, so you have to a take function whose return a node after k increments, but before that take two pointers points to head. And in while loop, you are increment 1 node in both pointers until the second ptr points to NULL. And, second ptr means which is points to a node after K increments.