0

我正在尝试打印存储在 BST 链接列表中的单词。当我尝试打印这个词时,它给了我“取消引用指向不完整类型的指针”错误。

我的打印功能在我的 BST 结构的头文件中。在我的主要功能中,我可以毫无问题地像这样打印出来,但它似乎不想在这个功能中打印。

//linked list struct
struct ll_node
{
    char * word;
    struct ll_node * next;  
};



//BST struct
struct bst_node
{
    int occurs;
    int diffOccurs;

    struct bst_node * left;
    struct bst_node * right;

    struct ll_node * words;
};



//printout function
void * printTree(struct bst_node * currBST)
{
    if(currBST == NULL)
    {
        return;
    }

    printf("%s\n", currBST->words->word);

    printTree(currBST->left);
    printTree(currBST->right);

}
4

1 回答 1

1

struct bst_node并且struct ll_node都应该在使用之前currBST->words->word定义。

于 2013-02-09T21:34:32.817 回答