#Array that creates arrays

6 messages · Page 1 of 1 (latest)

crystal whale
#

So basically i need to create a function that receive an array length for example,
for arr = {4,3,1} the length is equal to 3, then i need that the function will then create 3 new arrays.
dont really know how to do that.
Thank every one that helps....

north pikeBOT
#

This post has been reserved for your question.

Hey @crystal whale! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

cloud flicker
#

Well, I'm not going to do your homework for you, but I'll show you how I might accomplish this in the D programming language, and you can adapt it to java:

void main() {
  auto arr = [4, 3, 1];
  int[][] arrays = [];
  foreach (len; arr) {
    arrays ~= new int[len];
  }
}
crystal whale
#

The homework are much bigger then that, its just a small part which i don't understand how to make, because how can you create 3 new arrays and who is giving them their names?

#

Anyway thank you for your time...