I
Ioannis Vranos
I came across in clc++ this by chance:
"There is no language construct for dynamically allocating
multidimensional arrays. See the comp.lang.c FAQ question 6.16 and
related questions:
http://www.eskimo.com/~scs/C-faq/q6.16.html
(Substitute new for malloc appropriately)
--
Derrick Coetzee
I grant this newsgroup posting into the public domain. I disclaim all
express or implied warranty and all liability. I am not a professional. "
-----------------------------------------------------------------------
My answer:
What?
It is C++ here, not C. But I just checked that FAQ. Who wrote that CRAP?
Even the casts it has in malloc are not needed in C!
In any case in C it can be done:
#include <stdlib.h>
/* ... */
int (*p)[3]=malloc(2*sizeof(*p));
/* ... */
free(p);"
Fix your FAQ!
Regards,
Ioannis Vranos
http://www23.brinkster.com/noicys
"There is no language construct for dynamically allocating
multidimensional arrays. See the comp.lang.c FAQ question 6.16 and
related questions:
http://www.eskimo.com/~scs/C-faq/q6.16.html
(Substitute new for malloc appropriately)
--
Derrick Coetzee
I grant this newsgroup posting into the public domain. I disclaim all
express or implied warranty and all liability. I am not a professional. "
-----------------------------------------------------------------------
My answer:
multidimensional arrays.Derrick Coetzee said:> JKop wrote:
>>>> int (&on_the_heap)[2][3] = *new int[2][3];
>
>
> There is no language construct for dynamically allocating
What?
> See the comp.lang.c FAQ question 6.16 and related questions:
>
> http://www.eskimo.com/~scs/C-faq/q6.16.html
It is C++ here, not C. But I just checked that FAQ. Who wrote that CRAP?
Even the casts it has in malloc are not needed in C!
In any case in C it can be done:
#include <stdlib.h>
/* ... */
int (*p)[3]=malloc(2*sizeof(*p));
/* ... */
free(p);"
Fix your FAQ!
Regards,
Ioannis Vranos
http://www23.brinkster.com/noicys