D - Arrays of arrays question - answer needed quickly ...
- Matthew Wilson (17/17) Apr 10 2003 In C# I declare arrays of arrays as
- Walter (3/19) Apr 11 2003 It's correct. Note that the new syntax matches the declaration syntax.
- Matthew Wilson (3/29) Apr 11 2003 Thanks
byte[][] array1 = new byte[cAllocs][]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } In D, this does not work. It has to be byte[][] array1 = new byte[][cAllocs]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } Is this correct? It seems contradictory. A quick answer by anyone on this would be _greatly_ appreciated. :) Matthew
Apr 10 2003
"Matthew Wilson" <dmd synesis.com.au> wrote in message news:b74opb$2u8$2 digitaldaemon.com...byte[][] array1 = new byte[cAllocs][]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } In D, this does not work. It has to be byte[][] array1 = new byte[][cAllocs]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } Is this correct? It seems contradictory. A quick answer by anyone on this would be _greatly_ appreciated. :)It's correct. Note that the new syntax matches the declaration syntax.
Apr 11 2003
Thanks "Walter" <walter digitalmars.com> wrote in message news:b760fo$sr2$1 digitaldaemon.com..."Matthew Wilson" <dmd synesis.com.au> wrote in message news:b74opb$2u8$2 digitaldaemon.com...byte[][] array1 = new byte[cAllocs][]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } In D, this does not work. It has to be byte[][] array1 = new byte[][cAllocs]; // Allocate all indexes for(j = 0; j < cAllocs; ++j) { array1[j] = new byte[ . . . ]; } Is this correct? It seems contradictory. A quick answer by anyone on this would be _greatly_ appreciated. :)It's correct. Note that the new syntax matches the declaration syntax.
Apr 11 2003