• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What will fit where in multi-dimensional arrays

 
Brian Brumpton
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following Enthuware questions is giving me fits:

Given:
Which of the following will not cause any problem at compile time or runtime?

a. daaa[0] = d;
b. daaa[0] = daa;
c. daaa[0] = daa[0];
d. daa[1][1] = d;
e. daa = daaa[0];

The K&B Study Guide doesn't dedicate too many pages (pages 277 & 278) to explaining how to determine what will fit where. I keep getting it twisted at test time. Any ideas on keeping these straight?




 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In (very) short (as I'm answering on my mobile phone): dimensions MUST match, number of elements in an (multidimensional) array don't matter, index MUST of course be less than array length (otherwise runtime exception).

That's it (I guess)!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you'll find a very useful topic about multidimensional arrays with lots of info, examples and drawings.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And here is another topic about multidimensional arrays.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic