Given a binary tree, I need to change the **value in each node to sum of all the values** in the nodes **on the left side of the node**. Essentially each node should have the value equal to sum of all values of nodes visited earlier to this node in in-order traversal of the tree. Important point is this **has to be done without using integer pointer argument**. I am able to solve it with interger pointer argument to hold sum like this. Without this integer pointer variable, How do I hold sum when I visit right side of a node from its parent.

```
void modifyBST(struct node *root, int *sum) {

    if (root == NULL)  return;

    // Recur for right subtree
    modifyBSTUtil(root->left, sum);

    // Now *sum has sum of nodes in right subtree, add
    // root->data to sum and update root->data
    *sum = *sum + root->data;
    root->data = *sum;

    // Recur for left subtree
    modifyBSTUtil(root->right, sum);
}

```

**How do I modify this method such that int \*sum can be removed**.
My complete program is here [click here](http://ideone.com/zc61f0)

Example tree: 
Example tree: 
inorder: 4 2 5 1 6 3 7
preorder: 1 2 4 5 3 6 7
output : 4 6 11 12 18 21 28