I am working on a pset and I am having an error message: Looks like you're trying to use a variable that might not have a value? It says that cursor has not been initialised.I bolded the row where the error comes from.
I heed some help how to fix it, please.
for (int i = 0; i < N; i++)
{
node *cursor = table[i]; // place cursor to each bucket
node *tmp = cursor; // create a tmp equal to cursor
**while(cursor!= NULL)**
{
cursor = cursor->next; // move cursor to the next node
free (tmp);
tmp = cursor;
}
if (i == N-1)
{
return true;
}
}
return false;
}