Arrays decay to pointers. In the case of 2D arrays, an array of type T[x][y]
will decay into T(*)[y]
, not to T**
.
§ (8.3.4) Arrays:
If E
is an n-dimensional array of rank i × j × ... × k
,
then E
appearing in an expression that is subject to the array-to-pointer conversion (4.2) is converted to a
pointer to an (n−1)
-dimensional array with rank j × ... × k
. If the *
operator, either explicitly or implicitly as a result of subscripting, is applied to this pointer, the result is the pointed-to (n − 1)
-dimensional array, which itself is immediately converted into a pointer.
Your options are to manually reconfigure the type to match the type of the expression...
float (*temp)[1024] = a;
or use a multi-deminsional std::vector
or std::array
(C++11)...
std::array<std::array<int, 1024>, 1024> a;
auto temp = a;