Errors:
tree.c: In function ‘main’:
tree.c:51: warning: incompatible implicit declaration of built-in function ‘exit’
tree.c:51: error: too few arguments to function ‘exit’
tree.c: In function ‘preorder’:
tree.c:327: warning: comparison between pointer and integer
I can see exit();
is wrong correct it exit(0);
at line 327: if(ptr->right_ptr==link)
Is wrong because link
is integer defined as:
typedef enum { thread,link} boolean;
where as right_ptr;
is pointer:
struct node
{
struct node *left_ptr;
boolean left;
int info;
boolean right;
struct node *right_ptr;
}*head=NULL
I advise that this code is broken there is other many bugs, don't use it!
;