vault backup: 2023-11-16 09:27:09
This commit is contained in:
parent
09bd948ff7
commit
8e533df7ce
@ -3,8 +3,17 @@ An array is a vector in a collection
|
|||||||
To declare an array we use :
|
To declare an array we use :
|
||||||
```csharp
|
```csharp
|
||||||
public static void Main() {
|
public static void Main() {
|
||||||
int[] vect = new int[4] // Declare a vector of 4 elements
|
int[] vect = new int[4] // Declare a vector of 4 elements (from 0 to 3)
|
||||||
vect[4] = 22;
|
vect[3] = 22;
|
||||||
|
Console.WriteLine($"b = {b}");
|
||||||
|
Console.WriteLine($"{vect[3]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The result will be:
|
||||||
|
```bash
|
||||||
|
b = 0
|
||||||
|
22
|
||||||
|
```
|
||||||
|
|
||||||
|
We see that an array start from $0$ to $n-1$
|
Loading…
x
Reference in New Issue
Block a user