Skip to main content
This is a GNU extension
Source Link
Peter Cordes
  • 351.6k
  • 49
  • 674
  • 927

How to allocate a contiguous multidimensional array in GNU C++  ? There's a GNU extension that allows the "standard" syntax to work.

It seems the problem come from operator new []. Make sure you use operator new instead :

double (* in)[n][n] = new (double[m][n][n]);  // GNU extension

And that's all : you get a C-compatible multidimensional array...

How to allocate a contiguous multidimensional array in C++  ?

It seems the problem come from operator new []. Make sure you use operator new instead :

double (* in)[n][n] = new (double[m][n][n]);

And that's all : you get a C-compatible multidimensional array...

How to allocate a contiguous multidimensional array in GNU C++? There's a GNU extension that allows the "standard" syntax to work.

It seems the problem come from operator new []. Make sure you use operator new instead :

double (* in)[n][n] = new (double[m][n][n]);  // GNU extension

And that's all : you get a C-compatible multidimensional array...

Source Link
etham
  • 3.4k
  • 2
  • 17
  • 13

How to allocate a contiguous multidimensional array in C++ ?

It seems the problem come from operator new []. Make sure you use operator new instead :

double (* in)[n][n] = new (double[m][n][n]);

And that's all : you get a C-compatible multidimensional array...