开发者

Error 1 compiling using gcc in C and other errors

开发者 https://www.devze.com 2023-01-24 18:17 出处:网络
i have a program using two functions one is to insert a new node in a binary tree and the other is to print all leaves

i have a program using two functions one is to insert a new node in a binary tree and the other is to print all leaves

the errors are:

In file included from tree.c:4: tree.h:4: error: expected ‘)’ before ‘*’ token

tree.h:5: error: expected ‘)’ before ‘*’ token

tree.c:8: error: expected ‘)’ before ‘*’ toke开发者_如何学编程n

tree.c:28: error: expected ‘)’ before ‘’ token make: ** [tree.o] Error 1

line 4 &5

void insert(fyllo **root,int newnum);

void print_inorder(fyllo *last);

line 8 and under

void insert(fyllo **riza,int newnum){

 fyllo *neofyllo;

  neofyllo=ALLOC(fyllo);        

  neofyllo->right=NULL;

  neofyllo->left=NULL;

  if ((*riza)==NULL){
       *riza=neofyllo;
       (*riza)->num=newnum;              
       return;
       }
  if (newnum<(*riza)->newnum) insert(&(*riza)->left,newnum);
  else insert(&(*riza)->right,newnum);    
     }

line 28 and under

void print_inorder(fyllo *riza){

     if (riza==NULL) return ;
     inorder(riza->left);
     printf("%d ",riza->num);
     inorder(riza->right);
    }


The compiler seems to have trouble with the fyllo type, make sure it is declared correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消