Procedure to display all the nodes in a circular linked list.
Iterative Method :
voiddisplay(struct node *ptr) {// Use a do while loopdo {printf("%d\t",ptr -> data); ptr =ptr -> next; } while (ptr != head);}
Recursive Method :
voiddisplay(struct node *ptr) {// A flag variable to check if head is reached second timestaticint flag =0;if (ptr != head || flag =0) {printf("%d\t",ptr -> data);display(ptr -> head); }// Make flag 0 again as it is static flag =0;}