0
Dear masters, how much percent this kind of arrays using in c# world approximately?
To experts
4 Respostas
+ 2
haha, that's okey :) the comment section is the below the lesson, while the one above is the discussion section.
by the way, with regards to your question.
Yeah, jagged array is useful especially if ever you ever had to store tabular data with different number of rows.
for example,
when you are going to store data about 3 people's favorite fruits, but they have different number of favorite fruits, use Jagged array.
ex.
person1 loves "apples", "orange"
person2 loves "apple", "grape", and "mango"
person3 loves "grape" only
If you are going to store it in a jagged array.
//first, declare the array
string[][] faveFruits = new string[3][];
//next, initialize its values
faveFruits[0] = new string[]{"apple", "orange"};
faveFruits[1] = new string[]{"apple", "grape", "mango"};
faveFruits[2] = new string[]{"grape"};
--
Now, you have your jagged array.
Jagged array is useful when you have to store an array to another array.
0
what kind of array are you pertaining to?
0
Jagged (nested) arrays Ervin, sorry for i didn't write it, i was thinking these comments are only for this lesson.
0
Quite clear now, thank u Erwin.