Multi Arrays Explanation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Multi Arrays Explanation

So whats my problem? im trying to further umderstand multi arrays just incase its an importance but im trying to do 3 and im not sure how to cout a specific number, i tried but it gives me a weird number. THANKS AS ALWAYS! https://code.sololearn.com/cf3KvHELD8R7/?ref=app

15th Apr 2017, 1:44 AM
Seth T
Seth T - avatar
4 Answers
+ 8
There is no element at a[2][2][2]... You declared it as a[3][2][3] so the last element is a[2][1][2], I think. Then it outputs 50.
15th Apr 2017, 1:50 AM
J.G.
J.G. - avatar
+ 9
Yeah, I was confused too. I would avoid multidimensional arrays greater than 2 dimensions if possible. It just gets too confusing. I didn't figure that out by looking at the array; I had to look at the array declaration to figure that you were trying to access a bucket that didn't exist.
15th Apr 2017, 2:37 AM
J.G.
J.G. - avatar
+ 3
i just dont understand what is a good example of when you would need a mutlidimensional array
15th Apr 2017, 3:03 AM
Edward
+ 1
mmmm okay i get it, i mustv gotn thrown off, 3 is a bit to handle 😂. thanks 🙄!
15th Apr 2017, 2:03 AM
Seth T
Seth T - avatar