我目前正在用不透明指针写一个二叉树结构。但是,我用Valgrind写入了无效的内容。不透明指针valgrind
Tree.c:
struct node{
int key;
struct node *left, *right, *parent;
};
NODE nodeInit(void)
{
NODE tree = (NODE) malloc(sizeof(NODE));
tree->key = -1;
//Error with the 3 lines below
tree->right = NULL;
tree->left = NULL;
tree->parent = NULL;
return tree;
}
tree.h中:
typedef struct node* NODE;
注:我不能改变的头文件。