下列数据组定义语句中,哪些是正确的?(
)
A: int[ ] pins = new int[4] {1,2,3};
B: int[ ] pins = {1,2,3,4} ;
C: int[ ] pins = new int [3] {9,2,3,1};
D: int[ ] pins = new int[4];
)
A: int[ ] pins = new int[4] {1,2,3};
B: int[ ] pins = {1,2,3,4} ;
C: int[ ] pins = new int [3] {9,2,3,1};
D: int[ ] pins = new int[4];
举一反三
- pins=new int[4]{9,2,3,1}; 则pins[1]=()
- 下列哪个选项能正确的创建数组?( ) A: int[,] array = int[4,5]; B: int size = 2;int[] pins = new int [size]; C: string[] str = new string[]; D: int pins[] = new int[2];
- 关于二维数组的创建,以下做法正确的是: (1)int a[][] =new int[4][5] (2)int a[][] =new int[4][]; a[0]=new int[10];a[1]=new int[20]; (3)int a[][]; a=new int[3][]; a[0]=new int[3]; a[1]={1,2};a[2]={1,2,3};
- 下列哪个选项能正确的创建数组?( ) A: int[,] array=int[4,5]; B: int size=int.Parse(Console.ReadLine()); int[] pins=new int [size]; C: string[] str=new string[]; D: int pins[] = new int[2];
- 下面几条定义一维数组的语句,正确的是 A: int[] arr2 = new int[]; B: int[] arr2 = new int[5]; C: int arr2[] = new int[5]{1, 2, 3, 4, 5}; D: int[] arr2 = new int[5]{1, 2, 3, 4, 5, 6};