码迷,mamicode.com
首页 > 编程语言 > 详细

数组的四种创建方法

时间:2018-01-12 20:27:05      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:new   i+1   int   blog   ++   bsp   string   for   数组   

第一种:

string[] myArray = new string[10];

for(int i = 0; i<10;i++){

  myArray[i] = i+1;

}

第二种:

string[] myArray2 = {"1","2","3","4","5","6","7","8","9","10"};

第三种:

string[] myArray = new string[10]{"1","2","3","4","5","6","7","8","9","10"};

第四种:

string[] myArray = new string[]{"1","2","3","4","5","6","7","8","9","10"};

数组的四种创建方法

标签:new   i+1   int   blog   ++   bsp   string   for   数组   

原文地址:https://www.cnblogs.com/zcbAAA/p/8277383.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!