Theassignment top_node = new_copy.top_node; leaves theformer nodes of the left hand side
of the assignment operator as garbage. Moreover, when thefunction ends, the statically allocated
Stack new_copy will be destructed,this will destroy the newly assigned left hand side of the
assignment operator. We can avoid both problems by swappingthe pointers top_node and
new_copy.top_node as in thefollowing.