i have a function to create a circular list, i am having issues compiling, not sure if it is syntax, appreciate if someone can help.
void CreateCircularList(struct node** listRef, struct node** tailRef)
{
Push(&*listRef, "String 1");
*tailRef=*listRef;
Push(&*listRef, "String 2");
Push(&*listRef, "String 3");
Push(&*listRef, "String 4");
*(tailRef->next)=*listRef;
}
the compiler flags an error in the last line:
“Member reference base type ‘struct node*’ is not a structure or
union”
Any ideas why ? thanks
You probably want
as the last assignment.
You cannot write
tailRef->nextsincetailRefis a pointer to a pointer.I also suggest just coding
Push(listRef, "Some string");instead of yourPush(&*listRef, "Some string");for readability reasons.