-5

这是一个线程二叉搜索树。你能帮我找出为什么它不能编译吗?

http://codeworldtechnology.wordpress.com/2009/08/27/insertion-deletion-and-traversal-in-fully-in-threaded-binary-search-tree/

4

1 回答 1

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);

在第 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  

奉劝这段代码坏了还有其他很多bug,不要用!

;

于 2013-01-11T11:17:54.857 回答