print circular linked list c 2b 2b

Solutions on MaxInterview for print circular linked list c 2b 2b by the best coders in the world

showing results for - "print circular linked list c 2b 2b"
Alberto
08 Sep 2018
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}