On Wed, 17 Nov 2010 22:10:19 +0100 Matthias Pleh <s...@alter.com> wrote:
> void foo(char[] a) {} > void bar(char[][] b) {} > > int main(string[] args) > { > char[4] a; > char[4][4] b; > foo(a); // OK: implicit convertion > bar(b); // Error: cannot implicitly convert > // char[4u][4u] to char[][] > } > > what is the reason for the different behaviour? > What's best to pass such multidimensional arrays? I may be wrong, but it seems (also from main's signature) you're trying to apply plain C point-of-view to a D feature (dyn array). Also, maybe what you need is an array of strings? Finally, to initialise a dynamic array at a given dimension, you may use the idiom string[] strings = new string[dim]; (but this does not work for 2 dimensions, I guess) Sorry if I'm wrong and this does not help. Denis -- -- -- -- -- -- -- vit esse estrany ☣ spir.wikidot.com