c++ - 有人可以帮我吗?为什么它不编译?

标签 c++ c debugging

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

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

最佳答案

错误:

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/

相关文章:

c++ - 将 Try/Catch 与裸函数一起使用

c++ - std::sort 没有仿函数

ios - 如何查看出现问题的对象?

windows - 在 Windows 8.1 中将调试器附加到 Services.exe

c++ - 在另一台计算机上运行 .exe 文件时出现 "Missing MSCVP140.dll"和 "Missing VCRUNTIME140.dll"

c++ - 为什么这个 '1234' 的代码在 C++ 中编译?

c - 将每列中的第一个单词打印为一行。

c - 不使用递归反序列化二叉树

c - extern 是编写不是定义的声明的唯一方法吗?

jquery - Yii 和 Bootstrap : How debug jQuery when I get a strange behavior?