I have an assignment about a labyrinth solving algorithm and I used a path tree to solve it, these are my structs:
typedef struct node* nodePtr;
typedef struct root{
int coordX;
int coordY;
nodePtr child[4];
} root;
typedef struct node{
int coordX;
int coordY;
char val;
nodePtr child[3];
void* parent;
} node;
The parent pointer can be either a pointer to root or a pointer to node to not to have a loop in tree. I checked this thing on assigning nodes:
void assignNode(nodePtr *nodeAddr, int x, int y, char **maze, void *parent){
...some codes...
if(y != parent->coordY && x != parent->coordX)
This is where I get annoying error of
dereferencing 'void *' pointer
error: request for member 'coordY' in something not struct or union
error: request for member 'coordX' in something not struct or union