A way of allocating multidimensional arrays dynamically

Posted by C77431 on Stack Overflow See other posts from Stack Overflow or by C77431
Published on 2011-02-20T15:21:54Z Indexed on 2011/02/20 15:25 UTC
Read the original article Hit count: 189

salute..

I am learning dynamic allocations for multidimensional arrays in a book and I found some ways for that, And now haven't problem in it. But the author of the book shows us a way, but it doesn't work correctly. It is this:

pbeans = new double [3][4];         // Allocate memory for a 3x4 array

And this is the error:

error C2440: '=' : cannot convert from 'int (*)[4]' to 'int *'

how should i define pbeans ( if this type of coding is legal)?

and what is the problem exactly?

Regards.

© Stack Overflow or respective owner

Related posts about c++

Related posts about pointers