I have not understood how this code is error free.
- The function has a return type of ’ int ’
However in the driver function , we have just called the function without assigning it to an integer variable. - The function replaceSum(node *root) :
is supposed to make change to the original tree.
So how did this code work without passing the root by reference . Shouldn’t the code be
int replaceSum(node *&root) ?
How did the changes reflect?
https://ide.codingblocks.com/#/s/22746
line number : 160