C错误“;“基本类型太多”;定义函数时

C错误“;“基本类型太多”;定义函数时,c,struct,tcc,C,Struct,Tcc,我正在尝试创建一个二叉树。我正在尝试编写一个函数,将新节点插入到树中。它有两个参数:父节点和新节点 struct node { int value; struct node * left; struct node * right; void (*insert)( struct node*, struct node*); } void treeInsert( struct node* this, struct node* new){//this is the line that

我正在尝试创建一个二叉树。我正在尝试编写一个函数,将新节点插入到树中。它有两个参数:父节点和新节点

struct node {
  int value;
  struct node * left;
  struct node * right;
  void (*insert)( struct node*, struct node*);
}

void treeInsert( struct node* this, struct node* new){//this is the line that gives the error

  if ( new->value < this->value ){//this will insert it into the left one
    if (this->left == NULL){
      this->left = new;
    } else {
      this->left->insert( this->left, new);
    }
  } else {//this will insert it into the right one
    if (this->right == NULL){
      this->right = new;
    } else {
      this->right->insert( this->right, new);
    }
  }

}
struct节点{
int值;
结构节点*左;
结构节点*右;
void(*插入)(结构节点*,结构节点*);
}
void treeInsert(struct node*this,struct node*new){//这是给出错误的行
如果(new->valuevalue){//这将把它插入左边的一个
如果(此->左==NULL){
这个->左=新;
}否则{
此->左->插入(此->左,新);
}
}否则{//这将把它插入到正确的
如果(此->右==NULL){
此->右=新;
}否则{
此->右->插入(此->右,新);
}
}
}

当我用TCC编译时,我得到了一个错误:
错误:太多的基本类型

我不知道TCC,但是gcc警告说,在
结构
的末尾缺少分号


使用分号,gcc编译它时没有错误和警告。

我不知道TCC,但gcc警告说在结构的末尾缺少分号


使用分号,gcc编译它时没有错误和警告。

作为
节点
插入
成员,您是否给它分配了一些内容?不能直接调用
treeInsert
吗?
struct节点
定义中缺少分号意味着编译器认为函数定义中有两种类型(
struct节点{…}
void
)。这就好像您编写了
intvoidtreeinsert(…){…}
。C的语法是这样的,像这样的小遗漏可能会导致非常混乱的错误消息。
节点
插入
成员,您是否给它分配了一些内容?不能直接调用
treeInsert
吗?
struct节点
定义中缺少分号意味着编译器认为函数定义中有两种类型(
struct节点{…}
void
)。这就好像您编写了
intvoidtreeinsert(…){…}
。C的语法是这样的,像这样的小遗漏可能会导致非常混乱的错误消息。哦,哈哈。我是新的堆栈溢出,所以我不能再接受这个答案8分钟,但这修复了它。是的。我只是标记了tcc,因为我认为编译器可能是相关的。哦,哈哈。我是新的堆栈溢出,所以我不能再接受这个答案8分钟,但这修复了它。是的。我只是标记了tcc,因为我认为编译器可能是相关的。
b.c:10:1: error: expected ‘;’, identifier or ‘(’ before ‘void’
void treeInsert( struct node* this, struct node* new){...
struct node {
  int value;
  struct node * left;
  struct node * right;
  void (*insert)( struct node*, struct node*);
};