I am trying to create a two dimensional array of pointers.What is wrong with the declaration below
Node* root[100][100] = new Node*[100][100];
I am trying to create a two dimensional array of pointers.What is wrong with the declaration below
Node* root[100][100] = new Node*[100][100];
Realize that the first element is a pointer to a pointer so you should be having root as a pointer to a pointer to a pointer.And then essentially you create 100 pointers for each pointer.
Node*** root=new Node**[100];
for(int i=0;i<100;i++)
root[i]=new Node*[100];
Now root[40][60] will be of type Node*.
See working example here.
I wonder if you need "a pointer [to] a 2 dimensional array".
Node (*root)[100][100] = new Node[1][100][100];
or "a pointer [works as] a 2 dimensional array"
Node (*root)[100] = new Node[100][100];