Hey so I’m getting that error whenever I try to do something like this:
void swap(struct lnode* n1){
struct lnode*temp = n1->next;
}
I thought that I could have the temp pointer point to n1->next but it’s giving me the dereferencing pointer to incomplete type error. Can anyone help me?
Thanks
To access members of the struct a declaration like this is insufficient:
This gives you an incomplete type: the compiler now knows the name of the struct but doesn’t know what fields it contains. You can have pointers to incomplete types, but you can’t access their members, calculate their sizes, or do anything else that requires knowledge of the structure members.
A full definition is required. As in: