1/* Function to traverse a given Circular linked list and print nodes */
2void printList(struct Node *first)
3{
4 struct Node *temp = first;
5
6 // If linked list is not empty
7 if (first != NULL)
8 {
9 // Keep printing nodes till we reach the first node again
10 do
11 {
12 printf("%d ", temp->data);
13 temp = temp->next;
14 }
15 while (temp != first);
16 }
17}