namespace _039_數(shù)組 {
? ? class Program {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? //第一種 數(shù)組的初始化方式
? ? ? ? ? ? //int[] scores = {23,43,432,42,34,234,234,2,34} ;//使用這種方式賦值的時候,一定要注意 在數(shù)組聲明的時候賦值
? ? ? ? ? ? //第二種數(shù)組創(chuàng)建的方式
? ? ? ? ? ? //int[] scores = new int[10];
? ? ? ? ? ? //int[] scores;
? ? ? ? ? ? //scores = new int[10];
? ? ? ? ? ? //int[] scores = new int[10]{3,43,43,242,342,4,234,34,234,5};
? ? ? ? ? ? //Console.WriteLine(scores[10]);//當(dāng)我們訪問一個索引不存在的值的時候,會出現(xiàn)異常exception
? ? ? ? ? ? //char[] charArray = new char[2]{'a','b'};
? ? ? ? ? ? //Console.WriteLine(charArray[1]);
? ? ? ? ? ? string[] names = new string[]{"taikr","baidu","google","apple"};
? ? ? ? ? ? Console.WriteLine(names[0]);
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}