void removeLoop(node *head) { if (head == NULL) { return; } node *startOfLoop = getStartingNode(head); node *temp = startOfLoop; while (temp->next != startOfLoop) { temp = temp->next; } temp->next = NULL; cout << "loop is removed " << endl; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter