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

Pages: 1-

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 1:54

Look at it this way.
 
On most browsers, you can bring up your browsing history by pressing Control-H. (No, this is not going to become a discussion of werecows.) On Firefox, this brings up a sidebar that shows up on the left side of the window. If you put your mouse over the edge of the sidebar, the cursor will turn into a different kind of arrow. By clicking and dragging it, you can move the edge of the sidebar back and forth. You are, to put it another way, manipulating the border between the normal window and the history window. By moving the mouse, you can increase the portion of the window devoted to either part. In a more extreme view of this situation, you're increasing or decreasing the amount of existence the sidebar has.
 
Now, let's apply this idea to something more abstract. Look out your window. If you don't live in a highly urbanized area, you should be able to see the horizon. Think of this as the border between the land and the sky. The land and sky are obviously distinguishable thanks to this boundary. Now, if you were to "drag" the sash between the sky and the land, or to manipulate the border between land and sky, you would end up causing the sky to become larger and the land to become smaller, or vice versa. An effect of this might be to cause something that was just on the ground to suddenly be hundreds of feet in the air. Truly a frightening situation to be in. So, look at it this way - manipulating the border between two physical things shifts whatever balance there is in the interaction between those things. Alternatively, by manipulating the border between two things, you can change the manner in which they exist.
 
Still, this isn't that abstract, since it's still dealing with real things in the real world. Many believe that in this world, there are those things that are true, and those that obviously aren't. This divides reality into two extremes: truth and falsehood. But, since we have two extremes, logically one can imagine a boundary between those two extremes - the border between truth and lies. If one were to manipulate this border, suddenly things that were pure fantasy (flying pigs, for the sake of argument) have become reality - or things from reality have ceased to exist. This is how Yukari is said to have invaded the moon - by manipulating the border between truth and lies, as applied to the reflection of the moon on a pond, she was able to make the reflection of the moon into a manifestation of the actual moon, and so send her youkai army onto it. This is what's truly amazing about Yukari's power - the ability to manipulate the border between completely abstract concepts allows her to fundamentally change reality as we know it (at least in terms of two abstract concepts).

Name: Anonymous 2009-04-26 1:55

>>2
Cool story bro

Name: Anonymous 2009-04-26 2:11

 ゝ\          /ノ
 ゝ  \   ,,,,,  / .ノ
  乙  .へ(・ω・)ヘ  ゝ
  て,,,        .,,,,ゝ
     ~~フ//wwヽ~


PEACE MOTHERFUCKERS

Name: Anonymous 2009-04-26 2:15

There is not such thing as rectangular array, just an array of arrays (or, more precisely, pointers).

Name: Anonymous 2009-04-26 2:24

>>5
7/10

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.

Name: Anonymous 2009-04-26 3:11

I am trying to understand rectangular and jagged arrays.
Well, try harder, also try to understand [m][code][/m] tags.

Name: Anonymous 2009-04-26 3:37

C#
back to /MSDN/ please

Name: Anonymous 2009-04-26 10:48

>>1
just use sizeof(a[i])/(sizeof type) for each array

Name: Anonymous 2009-04-27 18:39

>>7
it's like i'm really on 2ch!

Name: Anonymous 2009-04-27 18:52

>>10
suck my duck

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