Double pointer array in c++

前端 未结 3 1323
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 11:11

I was reading a program about BTree, there I came across this : BTreeNode **C. I understand that it is a 2d array but it was initialized as C=new BTreeNode *[

3条回答
  •  北海茫月
    2021-01-29 11:14

    The statement C=new BTreeNode *[2*t]; allocates space for 2*t instances of type BTreeNode * and therefore returns a type BTreeNode ** pointing to the first element of such instances. This is the first dimension of your array, however no memory has been allocated for the second dimension.

提交回复
热议问题