I have a problem understanding this structure , would love to get a clear explanation.
typedef struct exp{
int x;
struct exp *parent;
struct exp **children;
}
what does it mean the parent and the children ?
“parent” is an array of this structure?
and what is the meaning of the children ? it’s an array of arrays?!
I really can’t understand..
and last thing, If I’m adding an element , it becomes a specific child of some parent, how can I reach all the children of a parent? shouldn’t it be a structure “List” (using next etc .. ? )?
thank you!!
This image shows a possible scenario:
It was obtained using this code and DDD
Basically, the
childrenfield is a vector of pointers tostruct exp. You decide how many elements to put there and the other things.PS: Code is only a demo, it has not quite a good quality.