Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I can fix my problem in C language?

What I have tried:

void bst::insert(int d)
{
   node*newnode = new node();
   newnode_>data = d;
   if(root==noull)
   {
      root=newnode;
   }
   else
   {
      node*tempnode = new node();
      node*backtempnode = newnode();
      tempnode = root;

      while(tempnode !=NULL)
      {
         backtempnode = tempnode;
         if(tempnode_>data<=newnode_>data)
         {
            tempnode = tempnode _>rightchild;
         }
         else
         {
         tempnode = tempnode _>leftchild;
         }
      }
      newnode_>parent =backtempnode;
      if(backtempnode _>data<=newnode_>data)
      {
         backtempnode_>rightchild=newnode;
      }
      else
      {
         backtempnode_>leftchild = newnode
      }
   }
}
Posted
Updated 21-Jan-19 4:59am
v2
Comments
Patrice T 21-Jan-19 7:54am    
you should think about telling us what is your problem.
KarstenK 21-Jan-19 8:28am    
it is obvious that the compiler told you the problem of using TOTALLY WRONG syntax. Use "-" instead of "_". That is the result "Copy & Paste" something found in the internet but not understanding it.
Stefan_Lang 22-Jan-19 2:58am    
I wonder what implementation of copy&paste would turn _ into - ? More likely the result of bad read&type skills. Or really bad OCR software ;-)

1 solution

How would we know? That's not C, it's but we have no idea what it is expected to do, much less what it does do that you didn't expect.

It won't compile in any language I'm aware of, if only because it's full of "_>" which probably need to be "->" if it's intended for C or C++.
It looks like you found some C++ code on the internet that almost does what you want, and typed it in badly without understanding either C++ or C ...
 
Share this answer
 
Comments
Klaus-Werner Konrad 21-Jan-19 9:50am    
Looks for me like an (incomlete) implementation of a binary tree ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900