vault backup: 2023-11-16 09:34:19
This commit is contained in:
parent
8e533df7ce
commit
57a80ca10d
@ -1,3 +1,4 @@
|
|||||||
|
## Simple array (1 dimension)
|
||||||
An array is a vector in a collection
|
An array is a vector in a collection
|
||||||
|
|
||||||
To declare an array we use :
|
To declare an array we use :
|
||||||
@ -17,3 +18,23 @@ b = 0
|
|||||||
```
|
```
|
||||||
|
|
||||||
We see that an array start from $0$ to $n-1$
|
We see that an array start from $0$ to $n-1$
|
||||||
|
|
||||||
|
## Complex array (x dimension)
|
||||||
|
To create a vect with multiple dimension, we just have to declare an array and add a brackets to define multiple dimension
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// First version
|
||||||
|
public static void Main() {
|
||||||
|
int[,] mat = new int[12, 9] // Declare an array of two dimensions mat with default value for [0]
|
||||||
|
mat[3, 4] = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Second version
|
||||||
|
public static void Main() {
|
||||||
|
int[,] mat = {
|
||||||
|
{ 2, 3 },
|
||||||
|
{ 4, 5 }
|
||||||
|
};
|
||||||
|
mat[3, 4] = 12;
|
||||||
|
}
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user