这是一个线程二叉搜索树。你能帮我找出为什么它不能编译吗?
最佳答案
错误:
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);
第 327 行: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
我建议此代码已损坏还有其他许多错误,不要使用它!
;
关于c++ - 有人可以帮我吗?为什么它不编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14276864/