Take out a piece of graph paper.
cut off the first (top) line of the squares.
Now that you have the first line of squares you should have a row of squares that go from left to right.
This is a 1 dimensional array. If you color in one of the squares and you try to tell me which one... you would tell me which number it is from left to right. Yes? That's how you know which spot in the array that you are using. I colored in square 9.
Now, take the rest of the graph paper and randomly color in just one square somewhere in the middle.
Now, count from the left until you get to the column your square is in and write that number down... for me it's 17.
Now, count from the top until you get to the row your square is in... for me it's 11
So my square is at (17,11) where is yours?
That is a two dimensional array.
There is one trick you have to remember. Computers start counting arrays at zero. so my square is actually at (16,10) because I started to count with a (1) rather than zero.
Now, color in square (5,5)... remember to start counting at zero.
That's all there is to it!
2007-08-07 23:59:44
·
answer #1
·
answered by Anonymous
·
0⤊
0⤋
Imagine 2 cupboards next to one another.
I know they are cupboards because I have named them cupboards. But there are two of them. Now I put a number in each one. To identify the cupboards I number them 0 and 1.
So
cupboards[0] = 3
will assign 3 to cupboards 0.
cupboards[1] = 27
will assign 27 to cupboards 1.
That is how arrays work.
Now I want to add two more cupboards. But instead of adding the cupboards along side the existing two I will put them on top of the existing cupboards.
I now have a box of 4 cupboards. They can be looked at as being in columns and a rows.
Now to allocate a number to one of my cupboards I need to specify the column and the row. Before it was just the row.
So
cupboards[0][0]=4
will assign the number 4 to the top left cupboard.
cupboards[0][1]=5
will assign the number 5 to the bottom left cupboard.
cupboards[1][0]=17
will assign the number 17 to the top right cupboard
etc.
Now just substitute cupboards for your data type of int, float double or class type.
I hope that helps.
2007-08-07 23:41:58
·
answer #2
·
answered by AnalProgrammer 7
·
0⤊
0⤋
The tutorial, as I saw was already posted, so I wont repeat something simple, but I will offer two links - that help me through my life. Good luck!
2007-08-07 23:55:14
·
answer #3
·
answered by kolibrizas 3
·
0⤊
0⤋
nicely my buddy, as you opt to be conscious of approximately good sites to be conscious of extra approximately computers, then you definately circulate to yahoo seek & sort there decide to be conscious of extra good sites approximately computers & see how the hunt facilitates you.
2016-12-15 09:01:53
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋
geeks who don't get dates
2007-08-07 23:22:31
·
answer #5
·
answered by Isaac a 2
·
0⤊
1⤋