foo.cc: In function 'int main()':
foo.cc:35:29: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
35 | cout<<a[i]<<" ";
| ^~~
foo.cc:34:22: note: within this loop
34 | for(int i=1;i<=n;i++)
| ~^~~
foo.cc:26:38: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]
26 | if(a[j]>a[j+1])
| ~~~~~^
foo.cc:24:30: note: within this loop
24 | for(int j=1;j<=n-i;j++)
| ~^~~~~
foo.cc:26:38: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
26 | if(a[j]>a[j+1])
| ~~~~~^
foo.cc:11:5: note: while referencing 'a'
11 | int a[3];
| ^
foo.cc:28:48: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
28 | swap(a[j],a[j+1]);
| ~~~~~^
foo.cc:11:5: note: while referencing 'a'
11 | int a[3];
| ^
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务