Having doubt in the question..pls tell whats wrong in my code

sir i was trying to write code for this question…(kth node from end of linked list)…
getting an error while running it…

void nodeFromEnd(node *&head,int k){
node * slow = head;
node * fast = head;
int jump = 1;
while(jump <= k){
fast = fast ->next;
}
while(fast != NULL){
fast = fast -> next;
slow = slow -> next;
}
cout<data;
}

In the first while loop, you forgot to increment the value of jump…so it is leading to an infinite loop.
Also Last line must be cout<< slow -> data

yes sir thank u… forgot to increment jump