struct list_node
{
struct list_node *next;
void *data;
};
struct list_node *get_last_nth_node(struct list_node *head, unsigned int pos)
{
struct list_node *ret = head;
unsigned int i = 0;
while(head && i < pos)
{
++i;
head = head->next;
}
if(!head)
{
return NULL;
}
while(head->next)
{
ret = ret ->next;
head = head->next;
}
return ret;
}