Hi,
I was working on Josephus problem, where I have to make a circular linked list and having errors in it. Will really appreciate if anyone can help me.
The following method is in Node Class:
void link(int num_people, Node* temp)
{
int n = num_people;
[B]head->next = new Node;[/B]
temp = head->next;
for(int x = 2; x < n; x++)
{
temp->next = new Node;
temp = temp->next;
}
}
error C2065: 'head' : undeclared identifier (error in line which starts with head->next)
error C2227: left of '->next' must point to class/struct/union/generic type (error in line which starts with head->next)
error C2227: left of '->next' must point to class/struct/union/generic type(error in line which starts with temp = head->next)
Thanks in advance.