How to create a set of arrays with FOR loop?

  • Thread starter Thread starter yaya via DotNetMonster.com
  • Start date Start date
Y

yaya via DotNetMonster.com

Let's say I wana create a set of arrays A1,A2,A3....
so if I use a for loop, can I create the arrays ?

for(int i=0; i<3; i++)
{
int []A(i+1) = new int[5];
} ^
|
A1,A2,A3
 
Let's say I wana create a set of arrays A1,A2,A3....
so if I use a for loop, can I create the arrays ?

int[][] A = new int[][3];

for(int i=0; i<3; i++)
{
A = new int[5];
}

But if you always want 3x5 you may want to use a rectangular 2D array
rather than a jagged one.



Mattias
 
Back
Top