2 dimensional array

My current program takes user input for an expression tree, example *2x and outputs

* 0 0
2 0 0
x 0 0

*2x is stored in a string.
the 2nd and 3rd columns represent a left-child right-child array. When one of the following operands are input "+ - * / " the zeros need to be changed to the locations of their child's. Like in this example 2 would be the left child of * and x would be the right child so the output should look like

* 1 2
2 0 0
x 0 0

The only way I have thought to do this is to use a switch statement to look for the operands but I don't know how to call on the index that it's child is in.
This is my code:

My current program takes user input for an expression tree, example *2x and outputs

* 0 0
2 0 0
x 0 0

*2x is stored in a string.
the 2nd and 3rd columns represent a left-child right-child array. When one of the following operands are input "+ - * / " the zeros need to be changed to the locations of their child's. Like in this example 2 would be the left child of * and x would be the right child so the output should look like

* 1 2
2 0 0
x 0 0

The only way I have thought to do this is to use a switch statement to look for the operands but I don't know how to call on the index that it's child is in.

You won't know until you get there. You can't be guaranteed that the next two items will be your operands (if it was something like *+3x2, for instance, I'm betting you would want to print out

Code:

* 1 4
+ 2 3
3 0 0
x 0 0
2 0 0

right?)

So, you'll need to set up something very much like a stack so that, as you read along you can see where the thing you are reading belongs.