Why after the conversion the branches in a binary tree, and it immediately disappears?

There is a binary tree that represents the Anglo-Russian dictionary. In one method I need to convert a branch into a tree.
struct Elem
 char eng[15]; // key
 char rus[15]; // value
 Elem *left, *right, *parent;
Tree::Tree(Elem* node)
 Copy(node, root);

void Tree::Copy(const Elem* from Elem* to)
 if (from == nullptr)
 to = nullptr;

 to = new Elem;
 strcpy_s(to->eng, 15, from->eng);
 strcpy_s(to->eng, 15, from->eng);

 cout << from->eng << '\t' << to->eng << endl;
 Copy(from->left, to->left);
 Copy(from->right, to->right);

Tree obj;
 Tree obj2(obj.GetRoot());
 cout << obj2.GetRoot();

So obj2.GetRoot() returns nullptr. Going through the debugger - everything is fine. Each node is correctly copied in the right place, but after this constructor conversion (if you can call it that), root immediately becomes nullptr. Can help to catch this bug?
July 2nd 19 at 17:30
1 answer
July 2nd 19 at 17:32
Here you create a new Elem in a local variable 'to'
to = new Elem;

After exiting the function this pointer is lost, and the original root is not changed.

Try to pass a pointer by reference, for example, so

void Tree::Copy(const Elem* from, Elem* &to)
Thank you. - Horace.Legros75 commented on July 2nd 19 at 17:35

Find more questions by tags C++