I am trying to make a circular linked list.
I will appreciate if anyone can tell me how to make it better.
int n = num_people;
Node *head = new Node;
head->next = new Node;
Node *temp = head->next;
for(int x = 2; x < n; x++)
{
temp->next = new Node;
temp = temp->next;
if(x == (n - 1))
{
temp = NULL;
}
}
if(temp == NULL)
{
temp = head;
}
Thank you.