Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

rectangular and jagged arrays

Name: I want to understand 2009-04-26 1:51

Hi.

Rectangular array:
//skipping decls for rows, columns
int[,] aryInts = new int[row,column];

//to iterate, lets say rows = 8 and columns = 8
for (i = 0; i < 8; i++)
{
   for (j = 0; j < 8; j++)
   {
       prtln(aryInts[i,j]);
   }
}


I am trying to understand rectangular and jagged arrays.

A rectangular array is like a matrix or chessboard, columns and rows are normalized and have no variance.

A jagged array is an array of arrays of varying length.

To loop over a jagged array in my inner loop I need to access the length method of the array stored at: aryInts[i], so I do not access an invalid index. The translation would be:

for (i = 0; i < jagged.Length; i ++)
{
for (j = 0; j < jagged[i].Length; j++)
{
prtln jagged[i][j];
}
}

Is this a rational way to think about this? Do any of you guys have a link to an article for fucking noobs with multi-dim arrays?

Name: Anonymous 2009-04-26 2:26


      \
        \   ............._
         \  '´:::::::::●:::ヽ
           /0::::::◆岡◆::',
        =  {o::::::::(;・∀・)::}
          ':,:::::::::::つ:::::::つ.
       =   ヽ、__;;;;::/
            し"~(__)

I have no idea what you're talking about. So here is a representation of character wearing a bomb costume.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List