2D Arrays


Introduction to Two-Dimensional Arrays

So far all the arrays that you have been exposed to in this tutorial have been one dimensional. The dimension of an array means the number of indices used to refer to one particular cell in the array. For a one-dimensional array this can be thought of as a cell's position in a list. For a two-dimensional array there is also a nice way to think of what the indices mean. You can think of the array as being a big spreadsheet where all of the locations have a particular row and column that uniquely identify them. By convention the first index is considered to be the row and the second number is considered to be the column number. As you can imagine, this structure also works well for modeling a board, such as a tic-tac-toe board, on a computer.

Figure %: Tic-tac-toe Board

In this topic we will also consider multi-dimensional arrays and show that you can choose to have arrays of any dimension that is useful for your task.

Take a Study Break

SparkLife

What's your Pretty Little Liars name?

Take this quiz to find out!

SparkLife

Which young actress just got married?

Click to find out!

SparkLife

Cat bearding WINS THE INTERNET

Have you seen this yet?

SparkLife

Scary movies with funny posters

These. Are. Hilarious.

Geek out!

The MindHut

Geeky Actors: Then and Now

Travel back in time!

The MindHut

Villains We Want These Actresses to Play

From super cute to super bad!

The MindHut

10 Movies Better Than Their Books

What do you think?

The MindHut

Summer Movie Open Thread

Leave your thoughts here!

The MindHut

12 Scientific Inaccuracies in Into Darkness

What did Star Trek get wrong?

The Book

Cover image

Read What You Love, Anywhere You Like

Get Our FREE NOOK Reading Apps