+ 1
Its 2 dimensional array or 3?
int[ ][ ] myArray = {{1,2,3}, {4}, {5,6,7}} ??? According to declaration...must be: int[ ][ ] myArray = {{1,2,3}, {4}}
5 odpowiedzi
+ 15
1d array means , set containing list of elements of same type
2d array means , set of 1d arrays
3d array means , set of 2d arrays
//mine own definitions , but makes easy to visualise them😂
+ 3
the two brackets after int says that the array is two dimensional. it has nothing to do with hiw many elements you store in them
+ 1
we have: int[ ][ ] myArr = {{1,2,3},{4},{5,6,7}}
{1, 2, 3} belongs to first [ ] and {4} belongs to second [ ] ok! but this brackets {5, 6, 7 } belongs to which [ ]???
+ 1
2D array is like a table, although each row can have different number of columns
your array is:
-------
1 2 3
4
5 6 7
-------
so it is 2-dimensional
you can add as many rows as you like (if enough memory)
0
what do you mean?