[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
array
For example, if you want to store 5 values, you can each give them a different variable name:
If you want to multiply all values, you will need to call all 5 variable names again:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
array
(general) Array
A way of storing multiple values in memory that can be accessed by index.For example, if you want to store 5 values, you can each give them a different variable name:
PSEUDOCODE EXAMPLE value1 = 1 value2 = 2 value3 = 3 value4 = 4 value5 = 5
If you want to multiply all values, you will need to call all 5 variable names again:
PSEUDOCODE EXAMPLE value1 = value1 * 2 value2 = value2 * 2 value3 = value3 * 2 value4 = value4 * 2 value5 = value5 * 2Doing much more math on them is cumbersome. An array can store these values and access them by their index in the array. This way, you can use a loop to do math with these values:
PSEUDOCODE EXAMPLE
MyArray[5] = 1,2,3,4,5
for index = 1 to 5
MyArray[index] = MyArray[index] * 2
Arrays in specific languages
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
