 
		C_Bridge
2019-10-28 11:35
#include <stdio.h>
int main()
{
int arr1[1][3]{{10,20},{30,40}}//使用第一种方式初始化方式声明并初始化二维数
组arr1
int arr2[2][2];
arr2[0][0]=10;
arr2[0][1]=20;
arr2[1][0]=30;
arr2[1][1]=40;
//使用第二种方式初始化方式声明并初始化二维数组arr2
printf("%d\n%d",arr1,arr2);
return 0;
}
=================================
hello.c: In function 'main':
hello.c:4:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
     int arr1[1][3]{{10,20},{30,40}}//使用第一种方式初始化方式声明并初始化二维数
                   ^
hello.c:4:26: error: expected ';' before '}' token
     int arr1[1][3]{{10,20},{30,40}}//使用第一种方式初始化方式声明并初始化二维数
                          ^
hello.c:4:27: error: expected expression before ',' token
     int arr1[1][3]{{10,20},{30,40}}//使用第一种方式初始化方式声明并初始化二维数
                           ^
hello.c:5:5: error: stray '\347' in program
     组arr1
     ^
hello.c:5:6: error: stray '\273' in program
     组arr1
      ^
hello.c:5:7: error: stray '\204' in program
     组arr1
       ^
hello.c:5:8: error: 'arr1' undeclared (first use in this function)
     组arr1
        ^~~~
hello.c:5:8: note: each undeclared identifier is reported only once for each function it appears in
hello.c:6:5: error: expected ';' before 'int'
     int arr2[2][2];
     ^~~
hello.c:7:5: error: 'arr2' undeclared (first use in this function)
     arr2[0][0]=10;
     ^~~~ 
				首先,第5行代码,int arr1[1][3]声明的是1*3矩阵而不是2*2矩阵,所以你要将int arr1[1][3]改成int arr1[2][2],其次,你每完成一行代码就少了“;”吗?
 
				int arr1[1][3]{{10,20},{30,40}}//使用第一种方式初始化方式声明并初始化二维数组arr1 是错的,初始化出来是arr1[0][0],arr1[0][1],arr1[0][2]。而且缺少赋值的符号“=”,正确写法:int arr1[2][2]={{10,20},{30,40}};
 
				=?呢
 
				int arr[2][2]={{10,20},{30,40}少了“;”
C语言入门
928109 学习 · 21543 问题
相似问题