У меня есть функция, которая рекурсивно освобождает:
#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;
Я получаю сообщение об ошибке
Предупреждение: инициализация из несовместимого типа указателя [-Wincompatible-pointer-types]
и его указание на 'p'.
Я не понимаю, почему это происходит.
Может кто-нибудь объяснить и сообщить мне, как это исправить?