Procedure to remove a node from a given position in a circular linked list.
voiddelete(struct node *ptr,int position) {// If the current head node is to be deletedif (position ==1) {while (ptr -> next != head) { ptr =ptr -> next; }if (ptr == head) {free(head); head =NULL; } else {// Change the linkptr -> next =head -> next;// Deallocate the memoryfree(head);// Change head head =ptr -> next; } }// If node from any other position is to be deletedelse {// Traverse to the required nodefor (int i =0; i < position -2; i++) { ptr =ptr -> next; }// Pointer for the node to be deletedstruct node *toDelete; toDelete =ptr -> next;// Change the linkptr -> next =toDelete -> next;// Deallocate the memoryfree(toDelete); }}