[quote]I’ve checked, and same is true for bi-dimensional arrays:
Yes, because you programm is ill-formed.
expression new float returns float () which is a pointer to array of ten floats, not a pointer to pointer to float.
new float will return float() - pointer to an array of 10 arrays of 10 floats.
I guess, you see the difference between float (*) and float ** - these are completely different types.
Usually, two dimensional array with float ** created in two steps:
float ** ptr = new float *;
for(int i = 0; i < 10; ++i)
ptr[i] = new float;
//It’s just an example, it’s not good way to programm in C++.
When you write now
ptr = 1.f;
((ptr + 0) + 0) = 1.f; - i.e. you have a pointer to the 0th elementh of array of pointers, you dereference it - *(ptr + 0) or ptr and this expression gives you 0th element in an array of pointers. This pointer points to 0th element of array of floats. After that, you dereference this pointer - ptr or ((ptr + 0) + 0) and you get 0th element of array of floats.
float (*ptr) = new float;
this is completely different situation.
ptr gives you an array of 10 floats, ptr will give you NEXT array of 10 floats etc.
float ** ptr = ///code from the first sample
ptr holds address of 0th elementh of such array
float (*ptr) = ///the second sample
[ [float][float][float][float][float][float][float][float][float][float] ][[.etc/
PS AFAIK now cint cannot work correctly with multidimensional dynamic arrays created this way.