given class (for example in name of X
) , I want to allocate array like that:
X** array=new X*[20];
Now some questions about what that I going to get:
-
How can I do it so that I will get in any cell
nullptr
in beginning? namely, after the allocation, for any1<=i<=20
I will getarray[i]=nullptr
? -
Let's look about the following function:
void Func(){
X** array=new X*[2];
X[0]=& X(5); X[1]=& X(3); }
it's ok to do it like that or that I must to do it withnew
?
Aucun commentaire:
Enregistrer un commentaire