typedef struct node
{
void *data;struct node *next;
}mynode;
mynode * find_loop(NODE * head)
{
mynode *current = head;while(current->next != NULL){mynode *temp = head;while(temp->next != NULL && temp != current){if(current->next == temp){printf("\nFound a loop.");return current;}temp = temp->next;}current = current->next;}return NULL;
}
No comments:
Post a Comment