Peter wrote:
> Hi,
>
> I want to use an array str, while each array element str[i]
> is an array of chars of fixed length, say 40;
> (abridged)
> I need something like :
>
> for (int i=0;i<50;i++)
> {
> char [] str[i] = new char[40];
> }
You've got two options. If every char array is the same length, eg. 40.
You can use a multidimensional array:
char[,] str=new char[40,40];
If the arrays aren't the same length, you must use a jagged array which
is an array-of-arrays.
char[][] str=new char[40][];
for (int i=0; i<40;i++) {
str[i]=new string[i*2];
}
Anders Norås
http://dotnetjunkies.com/weblog/anoras/