From 57a80ca10da999ce8e37ae400c58e6c01330f804 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 16 Nov 2023 09:34:19 +0100 Subject: [PATCH] vault backup: 2023-11-16 09:34:19 --- Prog/Array.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Prog/Array.md b/Prog/Array.md index 6cedbe8..cc0ad43 100644 --- a/Prog/Array.md +++ b/Prog/Array.md @@ -1,3 +1,4 @@ +## Simple array (1 dimension) An array is a vector in a collection To declare an array we use : @@ -16,4 +17,24 @@ b = 0 22 ``` -We see that an array start from $0$ to $n-1$ \ No newline at end of file +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; +} +``` \ No newline at end of file