English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

whats the meaning of this sentence?

Arrays represent the first time we're associating data items together.

2006-10-30 05:40:13 · 3 answers · asked by Hossein R 1 in Computers & Internet Programming & Design

3 answers

That's a very weird way to describe an array.

An array is an association of similar data items. For example, the array DaysOfTheWeek[ ] would contain 'Sunday' at index 0, 'Monday' at index 1, 'Tuesday' at index 2, and so on until you finally get 'Saturday' at index 6.

In code, it would look something like this:

DaysOfTheWeek[ ] = "Sunday" , "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday";

Then, if you wanted to reference one of the days, you could reference it by using its' index. For example, Thursday could be referenced with code that looks like this:

char[ ] someVariableName = DaysOfTheWeek[4];

Just remember that indexes start at 0 and not 1, which is why Thursday's index is at 4 rather than 5.

2006-10-30 05:48:26 · answer #1 · answered by Anonymous · 0 0

Computer training tends to start off telling you about basic variables like Integers, floating point numbers and strings.
These variables can only hold one value at a time. If you change the value then you lose the previous value.

An array allows you to hold multiple data values, usually of the same type under one name.
When you are introduced to arrays then it is the first time that you are able to look at an association of data items.

2006-10-30 18:03:14 · answer #2 · answered by AnalProgrammer 7 · 0 0

whoever wrote it is saying that the values in an array are associated together. They can be referenced individually or all togeterh. This is in contrast to primative data types int and bool.

2006-10-30 13:44:45 · answer #3 · answered by Doug k 3 · 0 0

fedest.com, questions and answers