Help with multi-dimentional array
no at spam.invalid
Wed Jul 9 16:59:13 PDT 2008
Era Scarecrow wrote:
Now let me doublecheck once more. If i DID this.
> abc = new xyz(4,4); //Non-stack and GC handles it, or i can malloc
> abcd xyz; //(Stack / non-Stack) static allocation
> I'll assume that
> 1) abcd is an array of 4 pointers that have 4 pointers each
> 2) It is not created by the GC, but instead resides on the Stack? (Please confirm)
You probably meant this:
abcd is contiguous space for 16 xyz values, accessed as a
two-dimensional array. I'm not sure what you mean when you talk about
pointers, but unless xyz is a pointer type, there are not pointers
involved. Except that when passed to a function, static arrays are
passed as the address of the first element. This is all like in C.
And yes, it's allocated statically, or on the stack. Unless you put it
inside a struct, in which case you can allocate it in any way you like,
as part of a struct instance.
Docs on heap allocating dynamic arrays can be a little tricky to find:
More information about the Digitalmars-d-learn