Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void printLast(node* head, int k , int size)
- {
- k=size - k+1;
- personNode* curr = head;
- int count = 1;
- while (curr)
- {
- if (count == k) // print only the k place and the after
- {
- printf("data is: %d\n", curr->data); // print
- return;
- }
- count++;
- curr = curr->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement