C#数组

作者: 答泡浴 | 来源:发表于2017-08-08 15:49 被阅读0次

    // float[] score;

    // string[] names;

    //初始化数组:动态化初始化, 静态化初始化

    //动态初始化:

    // 类型  数组名=new 类型 【数组长度】

    // int[] number = new int[10];//默认值是0

    // score = new float[10];//默认值:0.0f

    // names = new string[10];//默认值: null(空对象)

    // int[] number_3 = new int[3]{ 1, 2, 3};

    // int[] number_2 = new int[]{ 1, 2, 3 };

    // string[] names_1=new string[]{"china","asd123","123123"};

    ////静态初始化//int [] number_1={1,2,3,4,5,6,8};//string[] number_5 = { "鲜聪", "邱泽", "李福森" }; 

    //通过数组下标访问数组中的成员

    //string name= number_5[0];

    //Console.WriteLine (name);/

    /下标越界//string name1=number_5[3];

    //数组长度//int a=3;//if (a < number_1.Length) 

    {//Console.WriteLine (names_1 [a]);}

    //数组的遍历//for(int i=0;i=0;i--){

    // Console.WriteLine (intArray [i]);

    // }

    //求数组中所有元素的和

    // int a=0;

    相关文章

      网友评论

          本文标题:C#数组

          本文链接:https://www.haomeiwen.com/subject/ztgtrxtx.html