foo.cc: In function 'int main()':
foo.cc:12:13: warning: variable 'tem' set but not used [-Wunused-but-set-variable]
12 | int tem = 0;
| ^~~
foo.cc:34:47: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations]
34 | arr[i][j] = arr[i+1][j] + arr[i+1][j+1];
| ~~~~~~~~~~^
foo.cc:32:34: note: within this loop
32 | for (int j = 1;j <= 4;j++)
| ~~^~~~
foo.cc:17:47: warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations]
17 | arr[i][j] = arr[i+1][j] + arr[i+1][j+1];
| ~~~~~~~~~~^
foo.cc:15:34: note: within this loop
15 | for (int j = 1;j <= 4;j++)
| ~~^~~~
foo.cc:8:14: warning: array subscript 4 is above array bounds of 'int [4][4]' [-Warray-bounds]
8 | arr[4][1] = a;
| ~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
foo.cc:9:14: warning: array subscript 4 is above array bounds of 'int [4][4]' [-Warray-bounds]
9 | arr[4][2] = 1;
| ~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
foo.cc:10:14: warning: array subscript 4 is above array bounds of 'int [4][4]' [-Warray-bounds]
10 | arr[4][3] = 1;
| ~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
foo.cc:11:17: warning: array subscript 4 is above array bounds of 'int [4]' [-Warray-bounds]
11 | arr[4][4] = b;
| ~~~~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
foo.cc:26:14: warning: array subscript 4 is above array bounds of 'int [4][4]' [-Warray-bounds]
26 | arr[4][2] = 2;
| ~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
foo.cc:27:14: warning: array subscript 4 is above array bounds of 'int [4][4]' [-Warray-bounds]
27 | arr[4][3] = 2;
| ~~~~~^
foo.cc:3:5: note: while referencing 'arr'
3 | int arr[4][4];
| ^~~
[Hydro](https://hydro.ac)提供评测服务