Question

This is a threaded binary search tree. could you help me find out why it doesn't compile?

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

Pas de solution correcte

Autres conseils

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!

;

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top