Create Copy of a tree (cpp)

Given a binary tree,create the copy of the tree. node *copy(node* root)
node \*copy(node \*root)  
  
 node \*temp;  
   
 if(root==NULL)return(NULL);  
    
 temp = (node \*) malloc(sizeof(node));//or temp = newNode(root->data);  
 temp->value = root->value;  
  
 temp->left  = copy(root->left);  
 temp->right = copy(root->right);  
  
 return(temp);  


See also