+ 1

Can anybody explain to me how to build array in c# thanks lo

22nd Jul 2017, 10:28 AM
Nathalie Cator
Nathalie Cator - avatar
3 Answers
+ 3
int[] arr = new int[5]; array of 5 int
22nd Jul 2017, 10:38 AM
Omar Serrar
+ 3
string[] name = new string[2]; // [2] makes it a 1-D heap index with 2 slots Console.WriteLine("What is your name?"); name[0] = Console.ReadLine(); /*when prompted whatever you write here is saved in the 1st heap index slot */ Console.WrightLine("Nice to meet you {0}.",name); /*Array is stored starting at 0 so we call the 1st index by {0} or +name[0]+ output = Nice to meet you "USER-NAME". and now lets say for name[0] you give it the name BOT. Well now to call the name BOT later down the code just use"Text" +name[0]+ "here" or "text here{0}",name */
22nd Jul 2017, 8:11 PM
Voodoo Ranger
Voodoo Ranger - avatar
+ 2
string[] arr = new string[] { "sololearn", "is", "cool"};
22nd Jul 2017, 11:07 AM
Bagshot
Bagshot - avatar