这是一个线程化的二叉搜索树。你能帮我找出为什么不编译吗?
答案 0 :(得分:2)
<强>错误:强>
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
我可以看到exit();
错误正确exit(0);
:if(ptr->right_ptr==link)
错误,因为link
是整数定义为:
typedef enum { thread,link} boolean;
其中right_ptr;
是指针:
struct node
{
struct node *left_ptr;
boolean left;
int info;
boolean right;
struct node *right_ptr;
}*head=NULL
我建议此代码已损坏还有其他许多错误,请勿使用它!