+ 4

HELP ME 🆘❗️❓

8️⃣ or Error? Help! #include <iostream> using namespace std; int main() { int x[2][3] = {{2, 3, 4}, {8, 9, 10}}; cout << x[0][3] << endl; return 0; }

18th Nov 2018, 5:57 PM
Alex
Alex - avatar
8 Respuestas
+ 3
x[0][0]=2 x[0][1]=3 x[0][2]=4 x[1][0]=8 x[1][1]=9 x[1][2]=10 x[0][3]=error???? 3>length of array!!!
18th Nov 2018, 6:18 PM
Alex
Alex - avatar
+ 2
8??? o my god🤪
18th Nov 2018, 6:00 PM
Alex
Alex - avatar
+ 2
output 8!!!!
18th Nov 2018, 6:19 PM
Alex
Alex - avatar
+ 2
thanks
19th Nov 2018, 11:19 AM
Alex
Alex - avatar
+ 2
error in program or sololearn playground?
20th Nov 2018, 3:45 PM
Alex
Alex - avatar
+ 1
Array start from 0 That means x[0][3] is first element and 4th element inside it.
18th Nov 2018, 6:10 PM
Taste
Taste - avatar
+ 1
Because the way the array maps in memory that result are expected, In memory it simply looks like this 2 3 4 8 9 10
18th Nov 2018, 6:28 PM
Taste
Taste - avatar
+ 1
It is two dimentional array,and it is error.because [3] is not exists
20th Nov 2018, 3:13 PM
Saied Hossien
Saied Hossien - avatar