Introduction to Arrays


Summary and Introduction to Arrays

An array is a data structure that is used collect multiple variables of the same data type together into one variable. Rather than having separate variable names for many different integers, for instance, you could collect all of them together into one variable. This does not mean that you will want to have all of the integers in any program united into one integer array. However, there will often be times when certain integer variables are all related to one another in a way appropriate for an array.

The key thing to understand about arrays is that the data is collected together so that any element in the array can be accessed from the array using an index. Basically, you can think of an array as a list of elements where each of the elements has a unique place in the list, such as 1st, 2nd, or 25th. You can access any element from the list using its location in the list. Arrays can also be used as unordered sets, which are lists where the order is unimportant.

Take a Study Break

SparkLife

Star Trek gets SEXY

Chris Pine and Zoe Saldana heat up the red carpet!

SparkLife

Are you afraid of relationships?

Auntie SparkNotes can help!

SparkLife

Wanna get JLaw's gorgeous glow?

Click here for simple, sexy makeup tricks!

SparkLife

Sexy starlet style

See every single look from the Met Gala!

SparkLife

Who'd be on your zombie-apocalypse crew?

We already dib'sed Genghis Khan.

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

How To Look Like J-Law...

When you don't look like J-Law.

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