You can't de-reference a void*
like this. It needs to know the type of pointer (in your case either node*
or root*
). So, you need to typecast
your pointer (either node*
or root*
). In this particular case, as node.
ie instead of
if(y != parent->coordY && x != parent->coordX)
write
if(y != ((node*)parent)->coordY && x != ((node*)parent)->coordX)
But since it your code, as you mentioned it could be either kind of the pointer (node*
or root*
), you need to have some way to identify it and then do the typecasting appropriately.