diff --git a/C++/LinkedList/Cricular linklist b/C++/LinkedList/Cricular linklist new file mode 100644 index 0000000..be9d97f --- /dev/null +++ b/C++/LinkedList/Cricular linklist @@ -0,0 +1,18 @@ +/* Function to print nodes in +a given Circular linked list */ +void printList(Node* head) +{ + Node* temp = head; + + // If linked list is not empty + if (head != NULL) { + + // Print nodes till we reach first node again + do { + cout << temp->data << " "; + temp = temp->next; + } while (temp != head); + } +} + +// This code is contributed by rajsanghavi9