Mind map
Arrays
Map content
Arrays
An array is a fixed number of values of the same data type grouped under a single indentifier
Values can be assigned to or extracted from an array using the array name follow by the index (the position of the value) inside square brackets. For example: studentNames[4] where the array name is "studentNames" and the index is "4".
2D arrays
- These are the same as arrays except they use 2 dimensions. This means you can create a virtual table filled with values.
- In a 2D array, the index is slightly different; you need 2 numbers (separated by commas) rather than 1, the first number being which row you want and the second being the column. For example [2,4]
- Creating a 2D array is almost the same as a standard one but with a couple of slight differences.
- Creating a 2D array would look like this: string[,] studentNames = new.string[3,2] This would create a 2D array with 3 rows and 2 columns
To create an array you input the data type that the array will contain, follow this with a pair of square brackets, then the name of the array, then = new.(chosen data type)[length of array].
- Example: string[] studentNames = new.string[7] This would create an array of strings that's 7 values long and called "studentNames"
Information
- Description
- Mind Map on Arrays, created by Josh Bee on 03/06/2020.
- Created by
- Josh Bee
- Views
- 1
- Rating