0

Give reason for output 3.

#include <iostream> using namespace std; int main() { int arr[2][3]={{3,5,1},{2,9,4}}; int brr[2][3]={{2,5,8},{9,2,6}}; for(int i=0;i<2;i++){ for(int j=0;j<3;j++){ brr[i][j]+=arr[i][j]; } } cout<<brr[1][3]; return 0; }

4th Mar 2017, 5:27 AM
Gaurav Kaushik
Gaurav Kaushik - avatar
2 odpowiedzi
+ 1
It was asked in a challenge in this app and the output is actually 3. As I copied the code and had run this one
5th Mar 2017, 9:32 AM
Gaurav Kaushik
Gaurav Kaushik - avatar
0
in the statement " cout<<brr[1][3];" index is out of boundary. maybe you want to output brr[1][2] which is 10.
5th Mar 2017, 2:33 AM
Steven Cai
Steven Cai - avatar