I have a function which recursively frees:
#include "treeStructure.h"
void destroyTree (Node* p)
{
if (p==NULL)
return;
Node* free_next = p -> child; //getting the address of the following item before p is freed
free (p); //freeing p
destroyTree(free_next); //calling clone of the function to recursively free the next item
}
treeStructure.h:
struct qnode {
int level;
double xy[2];
struct qnode *child[4];
};
typedef struct qnode Node;
I keep getting the error
Warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
and its pointing to 'p'.
I don't understand why this is occurring.
Can someone please explain and inform me how to fix this?