Question: I know how to add integers, just can't manage to do for char[] type, please help .
The code below is for integer which does works, but how to compare in case of char ?

```
void insert (int a)
{
    node *newnode= new node;
    newnode->data= a;
    if ( isempty() )
    {
        root= newnode;
    }

    else
    {

        node *temp=root; 
        while(temp!=NULL)
        {
            if(temp->data > a)
            {
                if(temp->left==NULL)
                    temp->left=newnode;

                temp=temp->left;
            }
            else if(temp->data < a)
            {
                if(temp->right==NULL)
                    temp->right=newnode;

                temp=temp->right;
            }
            else if(temp->data==a)
                temp=NULL;
        }
    }
}  

```

Answer: 
You should only have to change the type of the `data` field in your nodes:  

`char data;`

If you want to have a data field that is more than one character, you should use `std::string`:  

`std::string data;` 

To make the BST more generic, consider using templates to define that data type. 

```
template <class DataType>
struct Node
{
  Node<DataType> * left;
  Node<DataType> * right;
  DataType         data;
};

```

**Edit 1:**  

If you insist on using `char *` for your string type in the node, you will have to change every comparison in your BST to use `strcmp`. The `std::string` data type already has `operator==` and `operator<` defined, so using `std::string` as your data type should require only changes to the node and wherever you specify the type of the `data`.
That's not answer but you have memory leak.
When in tree there is already that int you don't delete "newnode" 

where you have

```
 else
      if(temp->data==a)
           temp=NULL;

```

there should be

```
else
      if(temp->data==a)
        {
           temp=NULL;
            delete newnode;
        }

```

or you should use one of 

[std::shared\_ptr](http://en.cppreference.com/w/cpp/memory/shared_ptr) or [std::unique\_ptr](http://en.cppreference.com/w/cpp/memory/unique_ptr) (i think shared)