[Qt-interest] 答复: multidimensional array

Bob Hood bhood2 at comcast.net
Mon Aug 1 05:17:11 CEST 2011


Please reply to the list, not to me personally.

On 7/31/2011 8:39 PM, pengliang(彭亮) wrote:
>
> Yes.
>
> You are right. It crash and report stack overflow.
>

As Jason points out, you need to allocate something of this magnitude on the
heap. Something like:

typedef short dimensions[40][500];
[...]
// allocate the array and stuff something into it...
dimensions* abc = new dimensions[60];
abc[35][2][277] = (short)34;

and then release it when you are through:

delete [] abc;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110731/20984a67/attachment.html 


More information about the Qt-interest-old mailing list