Image

Imagecrispychris13 wrote in Imagecpp

Listens: kit clayton-translation of simplicity part 6

building a graph

im trying to build a graph and so far i only have the root and its 10 children. im desperately trying to make 10 children for each of the previous 10 children.
-----------------------------
private:
struct node{
node * kids;
}
node * root;

constructor:
root = new node;
root->kids = new node[10];

-----------------------------

the above works fine but then i try to do this
root->kids[1] = new node[10]; // trying to make the first child of root have 10 kids

// it doesnt work. anyone know whats wrong here? ive been going bananas the past day trying to figure it out.