initializing static rectangular arrays
llee
llee at goucher.edu
Sat Nov 17 13:54:31 PST 2007
Janice Caron Wrote:
> On 11/17/07, llee <llee at goucher.edu> wrote:
> > how do you initialize a static multidimensional array? I tried the following, but it did not work.
> >
> > float[3][4] array =
> > [
> > [1.1, 1.2, 1.3],
> > [2.1, 2.2, 2.3],
> > [3.1, 3.2, 3.3]
> > ];
>
> Isn't that a 3x3 array, not a 3x4 array?
>
> Anyway, I think the solution to your dilemma is the keyword "const".
> (Or if that doesn't work, try "static").
didn't work. I tried:
const float[3][4] elements =
[
[1.1, 1.2, 1.3, 1.4],
[2.1, 2.2, 2.3, 2.4],
[3.1, 3.2, 3.3, 3.4]
];
and the compiler returned "too many initializers" for each nested array.
More information about the Digitalmars-d
mailing list