C冲突类型错误而实际上没有冲突类型?

时间:2020-10-05 01:21:17

标签: c binary-search-tree

所以我在.h文件中声明了该函数,然后我只复制并粘贴了该函数声明并添加了分号,这样我就看不到错误的出处了。

来源:

struct node* remove(struct node* node, int key)
{
    
    if(search(root,removeMe)!=NULL){
        struct node* temp=search(root,removeMe);
        if(temp->left==NULL && temp->right==NULL)
        {
            temp=NULL;
            return node;
        }
    }
    return node;
}

标题:

#ifndef PROJECT2_BST_H
#define PROJECT2_BST_H typedef struct node {
    int key;
    struct node* left;
    struct node* right; }; struct node* insert(struct node* node, int key); void inorder(struct node *root);

//void quit(struct node *root); struct node* search(struct node* root,
int key);  struct node* remove(struct node* node, int key);

#endif //PROJECT2_IO_H }

1 个答案:

答案 0 :(得分:0)

您的问题是remove是标准库函数,通常在stdio.h中定义为

int remove (const char *__filename)

因此,我建议您更改函数的名称。也许在这种情况下,您可以在每个函数名称中添加诸如node_之类的前缀,以防止名称冲突。 node_removenode_insert