中国大学MOOC: 22. 下列一维数组初始化正确的是( )。A. int a[5]={1,2}; B. int a[2]={1,2,3,4,5}; C. int a[5]={, ,1,2}; D.int a={1,2};
举一反三
- 以下能正确定义数组并正确赋初值的语句是A. int n=5,b[n][n]; B. int a[1][2]={{1},{3}};C. int c[2][]={{1,2},{3,4}};D. int a[3][2]={{1,2},{3,4}}; A: int n=5,b[n][n]; B: int a[1][2]={{1},{3}}; C: int c[2][]={{1,2},{3,4}}; D: int a[3][2]={{1,2},{3,4}};
- 关于二维数组的创建,以下做法正确的是:(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: (1)(2)(3) B: (1)(2) C: (1)(3) D: (1)
- 22. 下列一维数组初始化正确的是( )。A. int a[5]={1,2}; B. int a[2]={1,2,3,4,5}; C. int a[5]={, ,1,2}; D.int a={1,2}; A: A B: B C: C D: D
- 22. 下列一维数组初始化正确的是( )。A. int a[5]={1,2}; B. int a[2]={1,2,3,4,5}; C. int a[5]={, ,1,2}; D.int a={1,2}; A: A B: B C: C D: D
- 以下不能对二维数组a进行正确初始化的语句是( ) 。A) int a[2][3]={0};B) int a[][3]={{1,2},{0}};C) int a[2][3]={{1,2},{3,4},{5,6}};D) int a[][3]={1,2,3,4,5,6};